Linux CentOS 7 Mysql installation

1. Uninstall mariadb
yum -y remove mariadb*
yum install -y perl-Module-Install.noarch
yum install -y libaio
2. Install mysql
rpm -ivh MySQL-server-5.6.32-1.el7.x86_64.rpm
rpm - ivh MySQL-devel-5.6.32-1.el7.x86_64.rpm
rpm -ivh MySQL-client-5.6.32-1.el7.x86_64.rpm
3. Modify the configuration file
cp /usr/share/mysql/my-default .cnf /etc/my.cnf
edit /etc/my.cnf
and add

# (note that mysql under linux is installed by default: table names are case-sensitive, column names are not case-sensitive; 0: case-sensitive, 1: no Case sensitive) 
lower_case_table_names=1 
#(Set the maximum number of connections, the default is 151, the maximum number of connections allowed by the MySQL server is 16384; ) 
max_connections=1000
max_allowed_packet = 20M
increase or modify
max_allowed_packet = 20M
(Note: if this value is set too small, it will cause a single Writing to the database after the record exceeds the limit fails, and subsequent record writes will also fail.)

4. Initialize MySQL and set the password
mysql_install_db
systemctl start mysql
cat /root/.mysql_secret #View the root account password
# The random password set for the root user at Wed Aug 3 15:03:26 2016 (local time): 8WnByKdRK_smLfug
mysql -uroot –p8WnByKdRK_smLfug
mysql> SET PASSWORD = PASSWORD('123456'); #Set the password to 123456
mysql> exit
mysql -uroot -p123456


mysql_secure_installation
mysql>grant all on *.* to root@'%' identified by 'yourpassword';
-- grant all on *.* to root@'222.128.9.37' identified by 'isBIM2015';
mysql>flush privileges;
5. Set boot auto-start
systemctl enable mysql

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326357494&siteId=291194637