Installing MySQL Server on Linux (Ubuntu and Kubuntu) for Ruby and Rails

I have installed MySQL on my Hardy Heron KDE4 remix after repeated efforts and that is why I thought that I should list the steps showing how to go about the task.

First of all open the terminal/konsole and type there “sudo apt-get install mysql-server ” and then press enter. You will be asked for your password and after providing password the installation will begin . In this you will also have to set up your MySQL password , so that your database remains secure .

Post installation type ” mysql -u root -p ” , you will be asked for your mysql password and after providing password , You should see the following :

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.0.51a-3ubuntu5.1 (Ubuntu)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.


If you see the above lines ,it means you can now work on MySQL, as far as i have understood this .

Installing MySql driver :

In konsole type “apt-cache search libmysqlclient ” to find out the different library versions available.You will see text similar to the following :

libcrypt-mysql-perl – Perl module to emulate the MySQL PASSWORD() function.
ser-mysql-module – contains the MySQL database connectivity module
libmysqlclient15-dev – MySQL database development files
libmysqlclient15off – MySQL database client library

Next install the library by typing ” sudo apt-get install libmysqlclient15-dev ” on the konsole . Library will depend on the version of MySQL you are using , you can select your library from the output which comes after writingΒ  “apt-cache search libmysqlclient” and then pressing tab two times .

Install MySQL driver with the Ruby ” gem install ” command . Type ” sudo gem install mysql ” on the konsole , here you will get various options choose “mysql-2.7” or any other latest version and install it . On successful install you will get a message stating that mysql-2.7 has been Successfully installed .

Your Installation of mysql is complete .

If you are new to MySQL , like me , you can install MySQL Query Browser and MySQL Administrator from the Adept Manager or Synaptic both of which are default package managers for kubuntu and ubuntu respectively. I have installed Query Browser and Administrator from Adept Manager as I am a Kubuntu user .

19 thoughts on “Installing MySQL Server on Linux (Ubuntu and Kubuntu) for Ruby and Rails

  1. Thanks a lot
    I have followed your brief howto and at last succeeded in using MySQL with Ruby; I will mention you and link to this thread in Italian Ubuntu forum

    • Welcome,
      I am glad that you liked my effort. Thanks for your appreciation as this will boost my confidence.
      Thanks, once again for taking out time and also for mentioning me in Italian ubuntu forum. πŸ™‚

  2. Im really a hpux OS-technician but some ass at management just handed over a task to install a clone enviroment to test if our “product” would work in our costumers environment. Normally “I dont do” apps and shit. So on shaky legs I installed and configured Red Hat, apche2, php, but I failed at mysql. Tonight Iv’e read tons of long explanations from selfcentered “webmasters” who like to invoke any detail they can come up with, in order to get respect or status from the community….. This was the shortest explanation I’ve read and the only one that helped me……. Now I can go to bed without worries and have the sunday off as well! Thanx man!

  3. Lamowitch, Thanks a lot !

    I was checking my mail in the morning and there I saw your comment .
    You have made my day, getting an appreciation from an OS-technician, made me really happy! πŸ™‚ πŸ™‚

    One of the best comments I have ever got, related to my posts. πŸ™‚
    Once again,thank you for taking out time and appreciating me.

  4. I am new to kubuntu as well. Setting up a server with Apache, MySQL and PHP on windows takes me less than 5 minutes. Setting it up on kubuntu took me 7 days and I still dont know how to do port forwarding on the machine – haha. Your posts here did help me alot as I was beginning to think that linux just dont have a GUI for MySQL or should I now say KDE??? What the heck, I dont know, still learning πŸ˜‰

  5. I am glad that I was able to help you, Nicksten πŸ™‚

    I don’t know about GUI for MySql as i have not done work in MySql. I had installed for some RoR tutorial,as it needed MySql.

    You should google about MySql GUIs.

    Linux is fun to work on. It takes time to get adapted to Linux because we are habitual to work on Windows for years.
    I write these tutorials to make it easy for Linux beginners and for my future reference.

    Thank you, for taking out time and writing a comment. πŸ™‚

    • thank you Josiah for taking out time and writing a comment.

      I went to your blog, Josiah, and I found it very interesting and appealing. I will need a tip or two regarding blog management and themes from you πŸ™‚

  6. Thank you very much for the post.

    I am new to this side of Linux and all help is gratefully recieved.

    Short and to the point is ALWAYS best.

  7. Hi there, I found your web site via Google even as searching for a related subject, your site got here up, it appears good. I’ve bookmarked it in my google bookmarks.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s