LinuxHow to install MySQL Server 5.7 on Deepin

How to install MySQL Server 5.7 on Deepin

Deepin OS has become many developers’ favourite Linux operating system in these days. It’s because of their modern light-weight user friend desktop environment. MySQL is a Relational Database Management System developed by Oracle. Many developers asked us how to install MySQL on Deepin.

How to Install LAMP(Apache, MySQL, PHP) Stack on Deepin

This Guide Will Introduce How to Install and Configure MySQL Server 5.7 on your Deepin Linux.

Install MySQL Server on Deepin

1. Update System

Open deepin terminal(ctrl+alt+T) and type these commands to update the deepin system. Enter the user password if required.

$ sudo apt-get update && sudo apt-get upgrade
update deepin packages
update deepin packages
2.Install MySQL Server 5.7
Type following command to install MySQL server 5.7. (Enter y to continue installation)
$ sudo apt-get install mysql-server-5.7
install mysql deepin
install MySQL deepin

3. Change User Authentication and Privileges

As Deeping is a Linux distribution based on Debian, ѕуѕtеmѕ runnіng MySQL 5.7 (and later vеrѕіоnѕ) the rооt MуSQL user іѕ to аuthеntісаtе uѕіng thе auth_socket рlugіn bу default rаthеr thаn with a раѕѕwоrd. Tо соnnесt MуSQL аѕ root, you have tо switch its аuthеntісаtіоn mеthоd frоm auth_socket tо mysql_native_password.

To do accomplish this, Open the deepin terminal and enter the following commands.

Note:- Replace  password   with your password.

$ sudo mysql -u root
> USE mysql;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
mysql> exit;
$ sudo service mysql restart
Change User Authentication and Privileges MySQL Deepin
Change User Authentication and Privileges

4. Configure MySQL Server 5.7 (Optional)

Here you will be given a choice to set or change MySQL password for the root user, Validate password plugin, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases.

Enter the following command to configure MySQL Server 5.7

$ mysql_secure_installation  

You can configure the MySQL server as you wish. The result will be like this.

debuggerme@debuggerme-PC:~$ mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: 

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: n
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
 - Dropping test database...

 - Removing privileges on test database...

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y

All done!

5. Test MySQL Server 

So you have successfully installed and configured MySQL Server 5.7. Now you can log in to MySQL Server and start coding.

$ mysql -h localhost -u root -p    # h - host , u - user , p - password
Test MySQL Server
Test MySQL Server

So you finally Installed and Configured MySQL Server on your Deepin Linux. Now you start to code. Happy coding!

Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here