linux6.5 RPM方式安装 mysql5.6

Posted lijinshan2018

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux6.5 RPM方式安装 mysql5.6相关的知识,希望对你有一定的参考价值。

步骤一、检查下linux是不是已经安装了mysql

# rpm -qa|grep mysql
mysql-libs-5.1.71-1.el6.x86_64

# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64  //卸载

# find / -name mysql//有mysql文件夹的话,把mysql的文件夹删掉

步骤二、下载需要的安装包,下载地址:

https://dev.mysql.com/downloads/mysql/5.6.html#downloads

步骤三、将下载的文件进行解压:

# tar -xvf MySQL-5.6.41-1.el6.x86_64.rpm-bundle.tar 
MySQL-client-5.6.41-1.el6.x86_64.rpm
MySQL-shared-compat-5.6.41-1.el6.x86_64.rpm
MySQL-test-5.6.41-1.el6.x86_64.rpm
MySQL-server-5.6.41-1.el6.x86_64.rpm
MySQL-devel-5.6.41-1.el6.x86_64.rpm
MySQL-shared-5.6.41-1.el6.x86_64.rpm
MySQL-embedded-5.6.41-1.el6.x86_64.rpm

步骤四、按顺序依次安装:

rpm -ivh MySQL-devel-5.6.41-1.el6.x86_64.rpm
rpm -ivh MySQL-server-5.6.41-1.el6.x86_64.rpm
rpm -ivh MySQL-client-5.6.41-1.el6.x86_64.rpm

没有ERROR日志,说明安装成功;

步骤五、启动mysql

# service mysql start
Starting MySQL.Logging to \'/var/lib/mysql/C5-3_SOA23.cnpc.com.cn.err\'.
   [  OK  ]

步骤六、查看默认密码

# cat /root/.mysql_secret 

步骤七、登录

# mysql -u root -p

遇到的问题:

1、登录时,报错

# mysql -uroot -p
mysql: unknown variable \'sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES\'

解决方式:

# vi /etc/my.cnf

把 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 这句话注释掉;

2、要使用sql语句,必须重设password

mysql> use mysql
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

解决方式:

mysql> SET PASSWORD = PASSWORD(\'123456\');//123456是新密码

3、设置远程登录:

mysql> GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'%\' IDENTIFIED BY \'123456\' WITH GRANT OPTION;
mysql> flush privileges;

以上是关于linux6.5 RPM方式安装 mysql5.6的主要内容,如果未能解决你的问题,请参考以下文章

LINUX6.5 + MYSQL5.6 + JIRA6.3 + CONFLUENCE5.9

RPM方式安装MySQL5.6

CentOS 使用RPM方式安装MySQL5.6

无外网情况下RPM方式安装MySQL5.6

RPM方式安装MySQL5.6

centos7和centos6.5环境rpm方式安装mysql5.7和mysql5.6详解