I have a fresh installation of Ubuntu 11.04. Since I want to work with a MySQL server on this machine I see, that if I enter mys in the terminal and hit TAB it completes to mysql. But if I do mysql -u it says
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)I thought "maybe I have to start the server first", so I tryed
/etc/init.d/mysqlUnfortunately bash tells me
bash: /etc/init.d/mysql: No such file or directoryIf I do locate mysql I get a whole bunch of directories and files with mysql in it. So it raises the question: Is MySQL pre-installed on Ubuntu 11.04 or do I have to install it manually? And if it is already installed, how do I configure/start the server, since the way I know how to start a MySQL server on Ubuntu /etc/init.d/mysql doesn't seem to work?
I got the feeling that I miss something and I'll be glad if someone could give me a hint.
Thanks!!
11 Answer
The package that needs to be installed for the MySQL server is named mysql-server. If /etc/init.d/mysql does not exist, the MySQL server is not installed. After installing it using sudo apt-get install mysql-server, it will be started automatically (after the installation and on startup).
Ubuntu has migrated from traditional initscripts to Upstart. If you run /etc/init.d/mysql [action] you'll get a notice.
To stop MySQL, run:
sudo stop mysqlTo start it:
sudo start mysql 0