2 我的电脑是Redhat 6.*版本号。所以这里使用上面一个
3 解压zip包
4 安装下面几个rpm
MySQL-client-advanced-5.6.20-1.el6.x86_64.rpm
MySQL-server-advanced-5.6.20-1.el6.x86_64.rpm
5 查看已经安装过的mysql
rpm –aq | grep mysql
结果:
mysql-libs-5.1.66-2.el6_3.x86_64
mod_auth_mysql-3.0.0-11.el6_0.1.x86_64
mysql-connector-java-5.1.17-6.el6.noarch
mysql-test-5.1.66-2.el6_3.x86_64
mysql-devel-5.1.66-2.el6_3.x86_64
libdbi-dbd-mysql-0.8.3-5.1.el6.x86_64
qt-mysql-4.6.2-25.el6.x86_64(这个不用卸载)
rsyslog-mysql-5.8.10-6.el6.x86_64
mysql-bench-5.1.66-2.el6_3.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
dovecot-mysql-2.0.9-5.el6.x86_64
php-mysql-5.3.3-22.el6.x86_64
mysql-5.1.66-2.el6_3.x86_64
mysql-server-5.1.66-2.el6_3.x86_64
说明上面这些Mysql相关的已经安装了。
6 卸载上面安装过的mysql
使用rpm –e mysql –nodeps –allmatches (不理会依赖关系,删除全部上一步查出来的同样的mysql)命令卸载上面不须要的mysql
比如:
rpm -e mysql-libs-5.1.66-2.el6_3.x86_64--nodeps –allmatches
依照同样的命令对安装的其他mysql进行删除。
7 将老版本号的几个文件手工删除
[root@localhost mysql]# rm -f /etc/my.cnf
[root@localhost mysql]# rm -rf/var/lib/mysql
[root@localhost mysql]# rm -rf/var/share/mysql
[root@localhost mysql]# rm -rf/usr/bin/mysql*
[root@localhost mysql]#
8 安装mysqlserver端
[root@localhost mysql]# rpm -ivhMySQL-server-advanced-5.6.20-1.el6.x86_64.rpm
Preparing... ###########################################[100%]
1:MySQL-server-advanced ########################################### [100%]
2014-10-12 15:22:30 0 [Warning] TIMESTAMPwith implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).
2014-10-12 15:22:30 6074 [Note] InnoDB:Using atomics to ref count buffer pool pages
2014-10-12 15:22:30 6074 [Note] InnoDB:Database physically writes the file full: wait...
2014-10-12 15:22:31 6074 [Note] InnoDB:Setting log file ./ib_logfile101 size to 48 MB
关于说明信息:
A RANDOM PASSWORD HAS BEEN SET FOR THEMySQL root USER !
You will find thatpassword in '/root/.mysql_secret'.
You must changethat password on your first connect,
no other statement but 'SET PASSWORD' willbe accepted.
See the manual for thesemantics of the 'password expired' flag.
Also, the account for theanonymous user has been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
which will also give you the option ofremoving the test database.
This is strongly recommended for productionservers.
See the manual for more instructions.
Please report any problems athttp://bugs.mysql.com/
The latest information about MySQL isavailable on the web at
http://www.mysql.com
Support MySQL by buying support/licenses athttp://shop.mysql.com
New default config file was created as/usr/my.cnf and
will be used by default by the server whenyou start it.
You may edit this file to change serversettings
9 安装mysql 的client
[root@localhost mysql]# rpm -ivhMySQL-client-advanced-5.6.20-1.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client-advanced ########################################### [100%]
10 安装MySQL-devel-advanced-5.6.20-1.el6.x86_64.rpm
[root@localhost mysql]# rpm -ivhMySQL-devel-advanced-5.6.20-1.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-devel-advanced ########################################### [100%]
[root@localhost mysql]#
11 改动mysql的password。第一次安装的时候在,第一次安装的时候的password文件在/root/.mysql_secret中
改动password:
[root@localhost ~]# pwd
/root
12 查看password:cat.mysql_secret
oracle收购Mysql后,新版的mysql刚安装完mysql后不能直接输入mysql登录数据库,而是设置了默认free passwordpassword,默认password放在了/root/.mysql_secret文件里,登陆后须要改动password.
13 改动password
A 启动mysql
service mysql start
B 假设想关闭服务。命令是servicemysql stop
14 登录server
mysql -u root -p
为用户设置新password
set password=password('123456');
也能够使用脚本 /usr/bin/mysql_secure_installation进行交互式的改动mysql的rootpassword
15.又一次启动一下redhat操作系统,然后再登陆(改动后再登陆发现登陆不了)