I’ll cover how to install MySQL Server on Ubuntu 18.04 Server. MySQL is a popular and widely used relational databases amongst developers, especially Linux based development projects.
Many developers prefer to use Ubuntu servers for their deployment servers, although a statement like that is obviously going to be met with some backlash from the Linux community and like any community people will have a difference of opinion. Personally, Ubuntu is my distribution of choice.
Installing mySql on Ubuntu servers is a relatively simple task, becasue mySql is available in the Ubuntu apt repository, which means it can be installed via the terminal as follows.
In this post we assume you are not logged in as root, and therefore require to elevate your privelege to the root user. If you are logged in as root, simply omit sudo from the commands
We can now install mysql
Depending on the installation process and package version you may be prompted to provide some additional information. I have noticed this has varied over the past few months so it is difficult to document definitively.
Once the installation is complete simply check the status of the service.
The mysql services for Ubuntu should be configured to start automatically. If not you can do this as follows.
Login into mySql Console
MySQL root user on Ubuntu does not have password and its use auth_socket plugin to authenticate the root user. You can only login to the MySQL root using the system root account or using the sudo command:
If you would like to set mysql root password, run the ALTER USERcommand as follows:
The above presented easy to follow guide to installing mySQL on Ubuntu. We did not cover the more complex security and administration process which you should bear in mind once you have installed the server.