linux安装mysql(5.1.73)
1.把之前的mysql包删除
yum remove mysql mysql-server mysql-libs mysql-server;
rpm -qa|grep mysql(查询出来的有关mysql 的 yum remove掉)
2.下载
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
3安装
rpm -ivh mysql-community-release-el6-5.noarch.rpm
yum update yum install mysql-server
4.查看mysql状态--- /etc/rc.d/init.d/mysqld status
启动mysql----/etc/rc.d/init.d/mysqld start
登录-----mysql -u root -p 空密码
修改密码 use mysql;
UPDATE user SET password=PASSWORD('123456') WHERE user='root';
刷新----flush privileges;
退出 exit;
5. 开放3306端口, vi /etc/sysconfig/iptables
添加-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
重启 service iptables restart(没有的iptables工具的yum安装)
6.登陆mysql
mysql -u root -p
输入密码123456
修改update user set Host='%' where User ='root' limit 3; ----%表示任意
会报错这里
不用管,执行
flush privileges;
exit;
重启mysql
service mysqld restart