Ubuntu 18.04 installation MySql
Because MySql5.7 adopted a new security mechanism, so in the process of installing previous versions and there are some differences.
installation
The system is Ubuntu 18.04, the first thing to do is to update the package index.
sudo apt update
After it can be installed directly.
sudo apt install mysql-server
Next will be the way to install mysql, if the situation has changed in the source country, the installation is very fast. Remember, though, in this version 5.7 which is not prompted to set a password or other configuration changes, seemingly because MySql think it is not safe.
Probably the installation is completed as follows:
Configuration
For MySQL uses a new security policy, security script needs to be run after installation incidental, so that it can access the database in the follow-up.
Execute the following command:
sudo mysql_secure_installation
There will be some tips and changes after executing, be sure to take your time in this step, because including setting a password.
verification
After all get that done above, we need to verify whether all normal, successful installation, you can execute the following command:
systemctl status mysql.service
Execution results are as follows:
If, as above, this proves successful installation.
log in
The difference is that before and after the installation is successful, if the login directly through the following command, still error.
mysql -u root -p
Tip information is as follows:
Resolve this error is very simple, only need to add sudo you can successfully sign in the front.