MySQL installation and configuration of remote access in a Linux environment

Source: Internet
Author: User
Tags change settings mysql in dedicated server

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
    • Change root password
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;
    • Restart MySQL Service
[[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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.