In Debian 10 Steps to deploy mysql on 0
1. Use the wget command to download the MySQL version you need. Here, use 0.8.13-1_all for Demo: wget http://repo.mysql.com/mysql-apt-config_0.8.15-1_all.deb .
2. After downloading, install the mysql distribution package with the w user with sudo permission:
sudo apt install ./mysql-apt-config_0.8.15-1_all.deb
The system will display the configuration menu, from which you can select the MySQL version to install.
MySQL 8.0 has been pre selected. If you want to install MySQL 5.7, please select MySQL server & cluster (currently selected: mysql-8.0), and then select the preferred one MySQL version
We will install MySQL version 8.0. Press Tab, select OK, and then press Enter (as shown above).
If you are not sure which version to choose, consult the documentation for the application you want to deploy on the server.
3. Use the following command to update the package list and install the MySQL Server package:
sudo apt update sudo apt install mysql-server
The installer will ask you to set the MySQL root password. Don't set the password now (leave it blank), we'll set it in the next section.
Next, you will see a message informing you about the new MySQL 8 authentication. Before selecting the default MySQL 8 authentication plug-in, make sure your application supports it.
After installation, MySQL service will start automatically. You can verify by entering the following:
sudo systemctl status mysql
The following appears:
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en Active: active (running) since Fri 2019-07-26 13:23:25 PDT; 37s ago ...
Run MySQL_ secure_ Use the installation command to set the root password and improve the security of MySQL installation:
sudo mysql_secure_installation
The following appears:
Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT 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 component? Press y|Y for Yes, any other key for No:
You will be asked to configure VALIDATE PASSWORD PLUGIN , this tool is used to test the strength of MySQL user password. Password authentication strategy is divided into three levels: low, medium and strong. If you do not want to set up the password verification plug-in, press ENTER.
The following appears:
Please set the password for root here. New password: Re-enter new password:
At the next prompt, you will be asked to set the password for the MySQL root user (that is, root).
Do the following and enter y for all
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 environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. 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 Success. 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 environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. - Removing privileges on test database... Success. 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 Success. All done!
To interact with MySQL through the terminal, use the MySQL client, which is installed as a dependency of the MySQL Server package.
If you choose the default authentication method to log in to the MySQL server as the root user type:
sudo mysql
Otherwise, if you choose the traditional authentication method to log in, enter:
mysql -u root -p
Run MySQL_ secure_ When the installation script, you will be prompted to enter the previously set root password. After entering the password, the MySQL shell will be displayed as follows:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 Server version: 8.0.17 MySQL Community Server - GPL ...