Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The installation and configuration method of MySQL5.7 under Ubuntu18.04

Shulou Source: shulou.com Published: 2022-06-02 08:13:06 09月30日 Update

This article mainly explains "how to install and configure MySQL5.7 under Ubuntu18.04". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "the installation and configuration of MySQL5.7 under Ubuntu18.04"!

I. installation

1. Install directly through the source

Sudo apt-get update

Sudo apt-get install mysql-server mysql-client

Sudo apt-get install libmysqlclient-dev

2. automatic installation in the whole process, and check after installation

Sudo netstat-atp | grep mysql

If a port is shown to be listening, the installation is complete and the mysql service has been started normally

2. Modify the initial root password

1. Connect to the MySQL server

Mysql-u root-p

2. After connecting to mysql, enter the following command to change the password:

Mysql > UPDATE mysql.user SET plugin= "mysql_native_password", authentication_string=PASSWORD ("abc456") WHERE user= "root"

Mysql > flush privileges

Mysql > exit

3. Restart the mysql service

Sudo service mysql restart

Allow root to log in remotely

1. Log in

Mysql-u root-p

Enter password: # enter the password you just set here

2. Update the host field of the root user to%

Mysql > UPDATE mysql.user SET host= "" WHERE user= "root"

Mysql > flush privileges

Mysql > exit

3. Restart mysql

Sudo service mysql restart

4. Bind public network listener IP

# modify the configuration of MYSQL service

Sudo vim / etc/mysql/mysql.conf.d/mysqld.cnf

Bind-address=0.0.0.0

# pay attention to opening the firewall port

Sudo ufw enable/disable # turn firewall on or off for more ufw-help view

# add allow rules

Sudo ufw allow 3306/tcp

# View added rules

Sudo ufw status

5. Uninstall

Sudo apt-get autoremove-purge mysql-server-5.7

Sudo apt-get remove mysql-server

Sudo apt-get autoremove mysql-server

Sudo apt-get remove mysql-common

Sudo apt-get remove libmysqlclient

Sudo apt-get remove mysql*

Dpkg-l | grep ^ rc | awk'{print $2}'| sudo xargs dpkg-P

At this point, I believe you have a deeper understanding of "the installation and configuration of MySQL5.7 under Ubuntu18.04". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Method configuration service password content more port rule firewall learning update login monitoring input fire prevention utility deeper whole process interest command Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Microsoft MariaDB Shulou Technology Shulou Tech Info