Linux Installation of mysql and Configuration of External Network Access

  • 2021-10-25 08:11:25
  • OfStack

Configuration steps

1. See if DNS is configured

If DNS is not configured, refer to the previous configuration of DNS

Configuration correlation

If the DNS yum command is not configured and the DNS of the Linux software library cannot be found, the free DNS1=114. 114. 114.114 can be configured, or a spare DNS2=119. 29.29. 29 can be added

2. Install mysql with yum


yum -y install mysql mysql-server mysql-dev

Here, yum is used for-y approval operation, and the following three softwares are mysql, mysql-server, mysql-dev independent sequence respectively

3. Start the mysql service


service mysqld start 

The service needs to be started here, otherwise no subsequent operation can be carried out

4. Configure the mysql default password


mysqladmin -u root password  ' xxxxx' 

Configure root password. In general, many external software cannot be accessed without password configuration

5. Configure external network access

Login Default root User Login Command Full Name is mysql-u root-p

mysql-p (Beginners had better use the full name of the command to practice, because after work with abbreviated command login, the default is root users, if 1 denier has a misoperation, will bring unexpected results! ! ! )


use mysql; 
update user set host='%' where user='root' and host='localhost';

6. Update permissions


flush privileges; 
exit; 

You cannot update the user table without updating permissions

7. Configure the firewall


service iptables stop 
chkconfig iptables off 

The firewall has an ip forbidden table, which is forbidden by default except port 22

8. Configure the mysql service to boot up


chkconfig mysqld on

Set mysql service to boot and start

Reasonably configure the firewall above

9. That's it. Try to access it with the external network

Write at the end

About configuring mysql1, you must practice more and be familiar with the operation, and practice more than 3 times a day


Related articles: