Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I'm trying to install mysql in ubuntu to run ruby on rails. I was going through the tutorial at Lynda. I have successfully installed ruby, gem & rails.

ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

gem -v

rails -v
Rails 2.3.14

Now, I am trying to install mysql. To do this, the tutorial asks to update the .profile file by adding a line.

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then

I added the following line to it:

export PATH="usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

I exited the terminal & opened a new instance. & when I do:

echo $PATH

It gives me:


mysql isn't coming up in the path.

To install mysql, I did:

sudo apt-get install mysql-client-core-5.5

& I can see that mysql is installed:

which mysql

But I cannot see mysql version:

mysql -v
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

What do I need to do install mysql. Will solving this error allow me to access mysql from the terminal or do I need to do anything else as well?

share|improve this question
.profile is read when you log in, not when you open a terminal. – geirha Apr 8 '13 at 13:40

1 Answer 1

MySQL has a client/server architecture. You now need to install the server -- not just tools that allow you to talk to it. It will probably have a name like 'mysql-server', so do "sudo apt-get install mysql-server".

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.