69

I tried running mysql in my terminal and I got:

The program 'mysql' is currently not installed.  You can install it by typing:
sudo apt-get install mysql-client-core-5.5

But when I do:

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

I get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
mysql-client-core-5.5 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 47 not upgraded.

Running ls -l /usr/bin/mysql returns:

ls: cannot access /usr/bin/mysql: No such file or directory

How should I proceed?

1
  • 1
    Try sudo apt-get --reinstall install mysql-client-core-5.5
    – StarNamer
    Aug 10, 2012 at 22:24

4 Answers 4

97

First, remove the current version of MySQL you're already using:

$ sudo apt-get purge mysql-client-core-5.5

Now, to install MySQL, run the following command from a terminal prompt:

$ sudo apt-get install mysql-server
$ sudo apt-get install mysql-client

During the installation process you will be prompted to enter a password for the MySQL root user.

Once the installation is complete, the MySQL server should be started automatically. You can run the following command from a terminal prompt to check whether the MySQL server is running:

$sudo ss -tlp | grep mysql

When you run this command, you should see the following line or something similar:

LISTEN 0      80                 *:mysql            *:*    users:(("mysqld",pid=898368,fd=20))

If the server is not running correctly, you can type the following command to start it:

$ sudo /etc/init.d/mysql restart

You can edit the /etc/mysql/my.cnf file to configure the basic settings: log file, port number, etc.

0
23

This command installs the MySQL server, which you need.

sudo apt-get install mysql-server

If you want to run commands from the workbench and not from a terminal, you need the client as well (this is optional):

sudo apt-get install mysql-client

For MySQL Workbench (also optional):

sudo apt-get install mysql-workbench
10

First you have to remove MySQL completely from your system using following commands in a terminal:

sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get update && sudo apt-get upgrade
sudo apt-get autoremove 
sudo apt-get autoclean

Now try to reinstall MySQL.

9

That suggestion seems a little bizzare because it would miss out other dependencies and utilities. I would just run this and be done with it:

sudo apt-get install mysql-client

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .