原文档地址:http://www.itpub.net/thread-1766546-1-1.html
1、在Linux服务器上通过wget命令取得rpm包:
wget –c http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-server-5.6.10-1.rhel5.x86_64.rpm/from/http://cdn.mysql.com
wget –c http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.10-1.rhel5.x86_64.rpm/from/http://cdn.mysql.com
wget –c http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-devel-5.6.10-1.rhel5.x86_64.rpm/from/http://cdn.mysql.co
2、进入下载目录,安装Mysql服务器:
.rhel5.x86_64.rpm
3、安装MySql客户端:
rpm -ivh MySQL-client-5.5.28-1.rhel5.x86_64.rpm
4、安装MySql开发依赖包:
rpm -ivh MySQL-devel-5.5.28-1.rhel5.x86_64.rpm
5、安装完成后看是否安装成功:
mysql
会出现错误提示:Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
可用如下命令启动服务:
service mysql start
6、登录MySql,如果忘记密码,则修改密码;修改MySql配置文件:
vi /etc/my.cnf
输入i,编辑配置文件;在Mysqld添加一行:
skip-grant-tables
按ESC,输入:wq退出文件编辑。
7、重度Mysql服务:
service mysqld restart
8、进入MySql,输入:
mysql -uroot -p
输入密码时直接回车进入MySql;输入:
use mysql
更改密码:
UPDATE user SET password=password("test123") WHERE user='root';
输入:
flush privileges;
exit;
重新登录即可。
9、设置服务开机启动:
chkconfig mysql on
或者进入/etc/rc.local文件,添加如下内容:
/etc/init.d/mysql start
10、设置完成后重启系统,并查看MySql端口信息:
netstat -nat