红联Linux门户
Linux帮助

RedFlag Linux SP3 安装MySQL 5.6

发布时间:2013-10-12 00:27:41来源:红联作者:yupanlovehlq
RedFlag Linux SP3 安装MySQL 5.6

这次选择RPM包安装。
MySQL网站下载好MySQL-5.6.14-1.linux_glibc2.5.i386.rpm-bundle.tar
然后解压出来。

首先删除原来的mysql5.0数据库的所有文件。

再执行以下命令使用RPM安装。
root@yupan opt]# rpm -Uvh MySQL-server-5.6.14-1.linux_glibc2.5.i386.rpm --force
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]


root@yupan opt]# rpm -Uvh MySQL-client-5.6.14-1.linux_glibc2.5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]


[root@yupan opt]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

这里发现mysql不能登陆。解决方法如下。

先停了数据库,
[root@yupan opt]# /etc/init.d/mysql stop
Shutting down MySQL..[确定]

再执行以下命令,跳过授权。
[root@yupan mysql]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

最后修改密码。
[root@yupan opt]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.14 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> UPDATE user SET Password=PASSWORD('80614621') where USER='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
[root@yupan opt]# /etc/init.d/mysql restart
Shutting down MySQL..[确定]
Starting MySQL.[确定]
[root@yupan opt]# /etc/init.d/mysql restart
Shutting down MySQL..[确定]
Starting MySQL.[确定]

最后安装好其它软件包
[root@yupan opt]# rpm -ivh MySQL-devel-5.6.14-1.linux_glibc2.5.i386.rpm
Preparing... ########################################### [100%]
package MySQL-devel-5.6.14-1.linux_glibc2.5.i386 is already installed
[root@yupan opt]# rpm -Uvh MySQL-devel-5.6.14-1.linux_glibc2.5.i386.rpm
Preparing... ########################################### [100%]
package MySQL-devel-5.6.14-1.linux_glibc2.5.i386 is already installed
[root@yupan opt]# rpm -Uvh MySQL-devel-5.6.14-1.linux_glibc2.5.i386.rpm --force
Preparing... ########################################### [100%]
1:MySQL-devel ########################################### [100%]
[root@yupan opt]# rpm -ivh MySQL-embedded-5.6.14-1.linux_glibc2.5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-embedded ########################################### [100%]
[root@yupan opt]# rpm -ivh MySQL-shared-5.6.14-1.linux_glibc2.5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-shared ########################################### [100%]
[root@yupan opt]# rpm -ivh MySQL-shared-compat-5.6.14-1.linux_glibc2.5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-shared-compat ########################################### [100%]
[root@yupan opt]# rpm -ivh MySQL-test-5.6.14-1.linux_glibc2.5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-test ########################################### [100%]


最后测试mysql ,登陆使用正常

[root@yupan opt]# service mysql start
Starting MySQL[ OK ]
[root@yupan opt]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.14

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
文章评论

共有 6 条评论

  1. 735513561 于 2014-09-17 20:23:55发表:

    感谢楼主发帖

  2. 于 2014-03-10 19:38:47发表:

    真是太感谢了,搞了一天的难题终于搞好了

  3. blough2013 于 2014-03-01 22:07:49发表:

    刚来的新手,要向老同志学习呀!我有一颗虔诚的心!!

  4. yupanlovehlq 于 2013-10-17 17:13:38发表:

    什么意思

  5. 地狱邪目 于 2013-10-12 09:27:20发表:

    本人过去、现在以及将来都不认识楼主,且自古以来与楼主无利益关系。楼主表述之事与本人无关,

  6. Capacity 于 2013-10-12 08:43:19发表:

    学习了