1、 卸载mariadb
yum -y remove mariadb*
yum install -y perl-Module-Install.noarch
yum install -y libaio
2、 安装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、 修改配置文件
cp /usr/share/mysql/my-default.cnf /etc/my.cnf
编辑/etc/my.cnf
增加
#(注意linux下mysql安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写)
lower_case_table_names=1
#(设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384; )
max_connections=1000
max_allowed_packet = 20M
增加或修改
max_allowed_packet = 20M
(注意:该值设置过小将导致单个记录超过限制后写入数据库失败,且后续记录写入也将失败。)
4、 初始化MySQL及设置密码
mysql_install_db
systemctl start mysql
cat /root/.mysql_secret #查看root账号密码
# 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'); #设置密码为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、 设置开机自启动
systemctl enable mysql
yum -y remove mariadb*
yum install -y perl-Module-Install.noarch
yum install -y libaio
2、 安装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、 修改配置文件
cp /usr/share/mysql/my-default.cnf /etc/my.cnf
编辑/etc/my.cnf
增加
#(注意linux下mysql安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写)
lower_case_table_names=1
#(设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384; )
max_connections=1000
max_allowed_packet = 20M
增加或修改
max_allowed_packet = 20M
(注意:该值设置过小将导致单个记录超过限制后写入数据库失败,且后续记录写入也将失败。)
4、 初始化MySQL及设置密码
mysql_install_db
systemctl start mysql
cat /root/.mysql_secret #查看root账号密码
# 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'); #设置密码为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、 设置开机自启动
systemctl enable mysql