Centos6.8 Mysql5.6 安装配置教程(转)
Posted xihong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos6.8 Mysql5.6 安装配置教程(转)相关的知识,希望对你有一定的参考价值。
-
检查之前安装版本与卸载:
1:检查之前版本;
rpm -qa | grep -i mysql
2:卸载之前安装所有;
yum -y remove mysql-libs*
-
安装与初始化:
1:安装;
rpm -ivh MySQL-server-5.6.34-1.rhel5.x86_64.rpm
rpm -ivh MySQL-client-5.6.34-1.rhel5.x86_64.rpm
rpm -ivh MySQL-devel-5.6.34-1.rhel5.x86_64.rpm
2:初始化;
cp /usr/share/mysql/my-default.cnf /etc/my.cnf
/usr/bin/mysql_install_db
-
修改ROOT密码:
1:启动;
service mysql start
2:查看默认密码;
cat /root/.mysql_secret
3:默认密码登录;
mysql -u root -pM5kgMmUWlVtyKaHC
4:设置密码;
SET PASSWORD = PASSWORD(‘root‘);
5:生效;
flush privileges;
-
远程访问授权:
use mysql;
select host,user,password from user;
update user set password=password(‘root‘) where user=‘root‘;
update user set host=‘%‘ where user=‘root‘ and host=‘localhost‘;
flush privileges;
exit
-
mysql 配置:
1:编辑配置文件;
vi /etc/my.cnf
2:修改配置如下;
[client]
password = 123456
port = 3306
default-character-set=utf8
[mysqld]
port = 3306
character_set_server=utf8
character_set_client=utf8
collation-server=utf8_general_ci
#(注意linux下mysql安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写)
lower_case_table_names=1
#(设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384; )
max_connections=1000
[mysql]
default-character-set = utf8
socket = /var/lib/mysql/mysql.sock
3:重启mysql;
service mysql restart
-
设置开机启动:
1:开机启动;
chkconfig mysql on
2:查看;
chkconfig --list | grep mysql
https://jingyan.baidu.com/article/b2c186c8216455c46ef6ff34.html
以上是关于Centos6.8 Mysql5.6 安装配置教程(转)的主要内容,如果未能解决你的问题,请参考以下文章