Environment: centOS1, download mysql installation file
[[email protected] ~]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
2. Install the downloaded RPM file
[[email protected] ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
3. Install MySQL Service
[[email protected] yum.repos.d]# yum install mysql-server
- Installing dependent files can take a long time, wait patiently, and enter "Y" all the Way
3. Modify the MySQL configuration file
[[email protected] yum.repos.d]# vim /etc/my.cnf
- Configuration files and Windows environments are no different
# for advice The change settings see# http://dev.mysql.com/doc/refman/5.6/en/ server-configuration-defaults.html[mysqld]## Remove Leading # and set to the amount of RAM for the most important data# CA Che in MySQL. Start at 70% of all RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128m## Remove Leading # to turn on a Very important data integrity option:logging# changes to the binary log between backups.# log_bin## Remove leading # to S Et options mainly useful for reporting servers.# the server defaults is faster for transactions and fast selects.# Adjust Sizes as needed, experiment to find the optimal values.# join_buffer_size = 128m# sort_buffer_size = 2m# read_rnd_buffer_ Size = 2mdatadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent Assorted security riskssymbolic-links=0# Recommended in standard MySQL setupsql_mode=no_engine_substitution,strict_ Trans_tables[mysqld_safe]log-error=/var/log/mysqld.logpId-file=/var/run/mysqld/mysqld.pid
- Don't forget to restart the MySQL service after the modification is complete
[[email protected] yum.repos.d]# service mysql restart
4. Set up MySQL remote access
mysql> use mysqlmysql> update user set password=password('root') where user='root';mysql> exit
- Restart the service after the modification is complete
[[email protected] yum.repos.d]# service mysql restart
- Login with username and password
[[email protected] yum.repos.d]# mysql -u root -p
- Modify host limits to allow MySQL to access remotely
mysql> grant all privileges on *.* to 'root'@'%' identified by 'password';mysql> flush privileges;mysql> exit;
[[email protected] yum.repos.d]# service mysql restart
- Open port
-
- Often with the Linux small partners must know, Linux many ports by default is off, we need to open according to their own needs, there is no modification of the port, the default 3306 open, this command is universal, to open a port only need to change port number to the corresponding
[[email protected] yum.repos.d]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
- Then we can connect to MySQL in our Linux environment remotely.
MySQL installation and configuration of remote access in a Linux environment