RedFlag Linux SP3 安装MySQL 5.6

作者: yupanlovehlq 2013-10-12 00:27:41
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>

相关资讯