1、下载mysql二进制文件mysql-5.6.20-linux-glibc2.5-i686.tar.gz,官方网址:http://www.mysql.com/
2、拷贝到/usr/local/ sudo cp mysql-5.6.20-linux-glibc2.5-i686.tar.gz /usr/local
3、解压 sudo tar -zxvf mysql-5.6.20-linux-glibc2.5-i686.tar.gz,并重命名mysql,sudo mv mysql-5.6.20-linux-glibc2.5-i686 msql
4、
shell> sudo groupadd mysql
shell> sudo useradd -r -g mysql mysql
shell> sudo cd /usr/local
shell> sudo ln -s mysql mysql
shell> sudo cd mysql
shell> sudo chown -R mysql .
shell> sudo chgrp -R mysql .
shell>sudo scripts/mysql_install_db --explicit_defaults_for_timestamp --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
shell>sudo chown -R root .
shell> sudo chown -R mysql data
shell> sudo bin/mysqld_safe --user=mysql &
# cd /usr/local/mysql/ # ./bin/mysql -u root 关闭当前终端重开一个终端以root身份登录mysql。 # mysql> use mysql; 修改root用户口令。 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('123') where User ='root'; Query OK, 3 rows affected (0.00 sec) Rows matched: 3 Changed: 3 Warnings: 0 mysql> exit # /etc/init.d/mysql restart 5、结束mysql安全模式,用正常模式运行mysql。 #cd /usr/loca/mysql/ #./bin/mysql -u root -p Enter password:你的新密码 这样就可以了