directory
1. Check whether mysql is installed in the system
2. Check whether the installation package is available
3. Install the mysql client
4. Install mysql server
5. Add the default character set to /etc/my. CNF
6. Start
7. Close
restart
Check the status
8. Enable the mysql service upon startup
9. Set the password of user root to 123456
10. Mysql connection
11. Set the remote access permission
12. How about viewing remote Settings
13. Set the device address
Connect to mysql with navcat test
16. Disable the firewall
17. Disable the firewall permanently
18. Check the status
1. Check whether mysql is installed in the system
/ root @ localhost ~ # yum list installed mysql * / root @ localhost ~ # RPM - qa | grep mysql *Copy the code
2. Check whether the installation package is available
[root@localhost ~]#yum list mysql*
Copy the code
3. Install the mysql client
[root@localhost ~]yum install mysql
Copy the code
4. Install mysql server
[root@localhost ~]#yum install mysql-server
[root@localhost ~]#yum install mysql-devel
Copy the code
5. Add the default character set to /etc/my. CNF
[root@localhost ~]#vim /etc/my.cnf
Copy the code
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql default-character-set=utf8 # Disabling Pecked-links is recommended to prevent 什 锦 burst security risks pecked-links =0 bind-address=0.0.0.0 # Set device address [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pidCopy the code
6. Start
[root@localhost ~]#service mysqld start -- start mysql or /etc/init.d/mysqld startCopy the code
7. Close
[root@localhost ~]#service mysql stop
Copy the code
restart
service mysqld restart
Copy the code
Check the status
service mysqld status
Copy the code
8. Enable the mysql service upon startup
[root@localhost ~]# chkconfig --add mysqld
Copy the code
9. Set the password of user root to 123456
[root@localhost ~]# mysqladmin -u root password 123456
Copy the code
10. Mysql connection
[root@localhost ~]# mysql -u root -pCopy the code
11. Set the remote access permission
mysql> use mysql mysql> GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%'IDENTIFIED BY 'admin' WITH GRANT OPTION; Mysql > flush PRIVILEGES; mysql> flush PRIVILEGES; - The setting takes effect immediatelyCopy the code
12. How about viewing remote Settings
mysql> SELECT DISTINCT CONCAT('User:''',user,'''@''',host,'''; ') AS query FROM mysql.user; mysql> exit; Exit the mysql serviceCopy the code
13. Set the device address
[root@localhost ~]# vi /etc/my.cnf
Copy the code
- The bind – address = 0.0.0.0
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql default-character-set=utf8 # Disabling Pecked-links is recommended to prevent 什 锦 burst security risks pecked-links =0 bind-address=0.0.0.0 # Set device address [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pidCopy the code
14. Restart the service
[root@localhost ~]# service mysqld start -- restart mysql service [root@localhost ~]# mysql -u root -p -- mysql> show global variables like 'port'; - check the port number + -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- + | Variable_name Value | | + -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + -- -- -- -- -- -- -- + | port 3306 | | +---------------+-------+ 1 row in set (0.00 SEC)Copy the code
Connect to mysql with navcat test
16. Disable the firewall
service iptables stop
Copy the code
17. Disable the firewall permanently
chkconfig iptables off
Copy the code
18. Check the status
service iptables status
Copy the code
ok
Continuously updated