centos下mysql最新版终于安装成功!备份一下几个关键地方(三)

2015-07-24 08:15:29 · 作者: · 浏览: 7
shared 来卸载,为了卸载干净,之后,将所有文件夹中有mysql的删除掉。然后再重新安装。

[root@localhost mysqlinstall]# ls
MySQL-client-5.6.19-1.linux_glibc2.5.x86_64.rpm
MySQL-devel-5.6.19-1.linux_glibc2.5.x86_64.rpm
MySQL-embedded-5.6.19-1.linux_glibc2.5.x86_64.rpm
MySQL-server-5.6.19-1.linux_glibc2.5.x86_64.rpm
MySQL-shared-5.6.19-1.linux_glibc2.5.x86_64.rpm
MySQL-shared-compat-5.6.19-1.linux_glibc2.5.x86_64.rpm
MySQL-test-5.6.19-1.linux_glibc2.5.x86_64.rpm
[root@localhost mysqlinstall]# rpm -ivh MySQL-server-*.rpm
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
[root@localhost mysqlinstall]# rpm -ivh MySQL-client-*.rpm
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]
[root@localhost mysqlinstall]# rpm -ivh MySQL-devel-*.rpm
Preparing...                ########################################### [100%]
   1:MySQL-devel            ########################################### [100%]
[root@localhost mysqlinstall]# service mysql status
 ERROR! MySQL is not running
[root@localhost mysqlinstall]# service mysql start
Starting MySQL.. SUCCESS! 

修改设置密码,原始密码在/root/这个文件夹里面,ls -a可以看到一个mysql的文件,里面有原始密码:

mysql> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> select user();
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> set password=password('zbphp.com');
Query OK, 0 rows affected (0.00 sec)

mysql> show user();
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user()' at line 1
mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

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

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.19    |
+-----------+
1 row in set (0.00 sec)

mysql>