所有命令:

1. 删除系统中已有的mysql

yum -y remove mysql

2. 下载rpm包

cd /usr/local/src

wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm

3. 解压rpm

rpm -ivh mysql-community-release-el6-5.noarch.rpm

4. 安装 yum install mysql-server

5. 启动mysql服务 service mysqld start

6 首次使用无密码登录mysql

mysql -u root

切换到mysql数据库

use mysql;

查看user表中的情况

select Host,user from user;

删除user值为空的数据行

delete from user where user='';

更改user为root的用户的密码

update user set password=password("******") where user='root';

更改user='root' Host='localhost' 的数据为user='root' Host='%'

update user set Host='%' where user='root' and Host='localhost';

给用户赋予所有权限

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '******' WITH GRANT OPTION;

使前面的修改生效

flush privileges;

服务端试登录

mysql -u root -p

打开防火墙端口

vim /etc/sysconfig/iptables

增加一行   

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

重启iptables服务   service iptables restart

尝试远程登录

---------------------- 详情

yum -y remove mysql

centos6.5安装mysql

cd /usr/local/src

wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm

centos6.5安装mysql

rpm -ivh mysql-community-release-el6-5.noarch.rpm

centos6.5安装mysql

yum install mysql-server

centos6.5安装mysql

centos6.5安装mysql

centos6.5安装mysql

centos6.5安装mysql

service mysqld start

centos6.5安装mysql

centos6.5安装mysql

mysql -u root

centos6.5安装mysql

use mysql;

centos6.5安装mysql

select Host,user from user;

centos6.5安装mysql

delete from user where user='';

centos6.5安装mysql

update user set password=password("******") where user='root';

centos6.5安装mysql

update user set Host='%' where user='root' and Host='localhost';

centos6.5安装mysql

centos6.5安装mysql

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '******' WITH GRANT OPTION;

centos6.5安装mysql

flush privileges;

centos6.5安装mysql

mysql -u root -p

centos6.5安装mysql

/etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

centos6.5安装mysql

service iptables restart

centos6.5安装mysql

远程客户端登录,本文使用的客户端为navicat

centos6.5安装mysql

相关文章:

  • 2021-07-23
  • 2021-08-23
  • 2021-05-24
  • 2021-12-29
  • 2021-11-02
  • 2021-12-09
  • 2021-11-29
  • 2021-10-04
猜你喜欢
  • 2021-06-16
  • 2022-01-22
  • 2021-10-12
  • 2021-08-21
  • 2021-10-25
  • 2021-04-04
相关资源
相似解决方案