Mysql本地包版
2018-06-17 本文已影响26人
葡小萄家的猫
下载
https://dev.mysql.com/downloads/mysql/


//下载至服务器
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.22-1.el6.i686.rpm-bundle.tar
2. 安装
2.1. 检测是否已经安装了mysql
rpm -qa | grep mysql
如果已经安装了,将其卸载,如:
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
2.2. 安装mysql
1、 mkdir /usr/local/src/mysql
2、 cd /usr/local/src/mysql
3、 tar -xvf MySQL-5.6.22-1.el6.i686.rpm-bundle.tar


//开始安装依赖以上问题是由于没有依赖导致
安装依赖:yum -y install libaio.so.1 libgcc_s.so.1 libstdc++.so.6 a

需要升级libstdc++-4.4.7-4.el6.x86_64
yum update libstdc++-4.4.7-4.el6.x86_64
安装依赖:
yum -y install libncurses.so.5 libtinfo.so.5
//安装
rpm -ivh MySQL-server-5.6.22-1.el6.i686.rpm
rpm -ivh MySQL-client-5.6.22-1.el6.i686.rpm
启动mysql服务
service mysql start
使用root账号登录mysql(查看默认密码)
cat /root/.mysql_secret
# The random password set for the root user at Sun Jun 17 19:33:44 2018 (local time): yfMSclrv28QNCBuX

//改密
使用密码登录mysql账号:mysql -uroot -p
修改root密码:SET PASSWORD = PASSWORD('123456');
系统启动时自动启动mysql服务
加入到系统服务:
chkconfig --add mysql
自动启动:
chkconfig mysql on
查询列表:
chkconfig
说明:都没关闭(off)时是没有自动启动。
开启远程访问
登录:
mysql -uroot –p123456
设置远程访问(使用root密码):
grant all privileges on *.* to 'root' @'%' identified by '123456';
flush privileges;
防火墙打开3306端口
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save
/etc/init.d/iptables status
//加密秘钥
set password for root@localhost=password('123456');
set password for root@127.0.0.1=password('123456');
select user,host,password from mysql.user;//查看加密后的秘钥