Time for action – installing MySQL on Ubuntu
This section shows you the procedure to install MySQL on Ubuntu. Before starting, please note that Ubuntu typically includes MySQL out of the box. So if that’s the case, you’re done. If not, please follow these instructions:
Note
In order to follow the tutorial you need to be connected to the Internet
- Open Ubuntu Software Center.
- In the search textbox, type
mysql
. A list of results will be displayed as shown in the following screenshot: - Among the results, look for MySQL Server and click on it. In the window that shows up, click on Install. The installation begins.
Note
Note that if MySQL is already installed, this button will not be available.
- At a particular moment, you will be prompted for a password for the root user—the administrator of the database engine. Enter a password of your choice. You will have to enter it twice.
- When the installation ends, the MySQL server should start automatically. To check if the server is running, open a terminal and run this:
sudo netstat -tap | grep mysql
- You should see the following line or similar:
tcp 0 0 localhost:mysql *:* LISTEN -
- At any moment, you can start the service using this command:
/etc/rc.d/init.d/mysql start
- Or stop it using this:
/etc/rc.d/init.d/mysql stop
What just happened?
You installed MySQL server in your Ubuntu system. In particular, the screens that were displayed belong to Version 12 of the operating system.
Note
The previous directions are for a standard installation. For custom installations you can visit this page https://help.ubuntu.com/12.04/serverguide/mysql.html. For instructions related to other operating systems or for troubleshooting information you can check the MySQL documentation at http://dev.mysql.com/doc/refman/5.5/en/windows-installation.html.
Have a go hero – installing a visual software for administering and querying MySQL
Beside the MySQL server, it’s recommended that you install some visual software that will allow you to administer and query MySQL. Now it’s your time to look for a software of your choice and install it.
One option would be installing the official GUI tool: MySQL Workbench. On Windows, you can install it with the MySQL Installer. In Ubuntu, the installation process is similar to that of the MySQL server.
Another option would be to install a generic open source tool, for example, SQuirrel SQL Client, a graphical program that will allow you to work with MySQL as well as with other database engines. For more information about this software, visit this link: http://squirrel-sql.sourceforge.net/.