How to install MySQL on Linux Debian 9?

How to install MySQL on Linux Debian 9?

MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation. MySQL is a database management system. MySQL databases are relational. MySQL software is Open Source. The MySQL Database Server is very fast, reliable, scalable, and easy to use. MySQL Server works in client/server or embedded systems. A large amount of contributed MySQL software is available. – by dev.mysql.com

MySQL is a very famous and popular open source relational database management system. Installing MySQL on Linux Debian 9 is very easy and straight forward. This blog will help you the step by step procedure to install the MySQL on Linux Debian 9.

change directory

Execute the below command to change the directory to “/tmp”.

cd /tmp

download MySQL PPA

The MySQL PPA for Debian Linux is available on the MySQL official site. Execute the below commands to download the MySQL PPA.

sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
sudo dpkg -i mysql-apt-config* 

During the installation of MySQL apt config package will prompt you to select the MySQL version to install. Select the MySQL 5.8 or 5.7 option to install on your system.

MySQL server & cluster
MySQL version

Select “OK” on package confirmation screen.

OK screen

Install MySQL

Update the existing packages once again and start to install the MySQL by executing the below commands.

sudo apt update 
sudo apt install mysql-server

Enter the root password to login into the MySQL as a root user.

Enter root password

Re-enter root password once again.

Re-enter root password

Select “Strong Password Encryption” on the screen for safe.

Strong Password Encryption

check the system control status

By executing the below command to check the MySQL running status on system control.

sudo systemctl status mysql
MySQL system control status

secure mysql

By executing the below command to secure your MySQL.

mysql_secure_installation

You should answer the questions prompted on the screen to secure your MySQL installation.

Would you like to setup VALIDATE PASSWORD component?
 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
 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) : n
 … skipping.
 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! 

test mysql

Execute below command to test the MySQL and check the version.

mysqladmin -u root -p version
MySQL version

MySQL has been successfully installed on Linux Debian 9.

How useful was this post?

Click on a star to rate it!

As you found this post useful...

Follow us on social media!

Advertisements

Post your comments