Installation and use of mysql under linux system centos

Installation and use of mysql under linux system centos
1. Database installation (scattered pieces, unable to find the actual installation directory)
yum install mysql-server
 
1.1 set mysql character set
/etc/my.cnf  
default-character-set=utf8
 
1.2 mysql startup and shutdown
Start: mysql:sevice mysqld start or /etc/init.d/mysqld start
Shutdown: service mysqld stop
Restart: service mysqld restart
 
1.3 Add boot up
chkconfig -add mysqld; 
Boot up: chkconfig mysqld on;
 
2. Remote authorization [Reference address: http://www.2cto.com/database/201305/210279.html ]
 
2.1 The firewall allows remote access to the mysql port
Open the iptables configuration file: vi /etc/sysconfig/iptables
add configuration
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
 
2.2 Restart the firewall
service iptables restart
Remote testing
telnet 192.168.16.128 3306 success
 
2.3 mysql user authorization for remote use
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
effective command
FLUSH RIVILEGES;
 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327054550&siteId=291194637