Linux下安装mysql

安装mysql:yuminstall -y mysql-server mysql mysql-deve

启动mysql:service mysqld start

CentOS信息:[root@localhost /]# uname -a
Linux localhost.localdomain 2.6.32-71.el6.i686 #1 SMP Fri Nov 12 04:17:17 GMT 2010 i686 i686 i386 GNU/Linux

安装完成以后,客户端还是连接不上,限制了连接IP,需要更改,在本机上按如下操作

Host '192.168.0.102' is not allowed to connect to this MySQL server

[cjwang@localhost ~]$ mysql   -h   localhost   -u   root

mysql> GRANT   ALL   PRIVILEGES   ON   *.*   TO   'root'@'%'   WITH   GRANT   OPTION;

mysql> FLUSH   PRIVILEGES;

mysql> EXIT

经过测试,以上方法可行,现在可以通过root登录了,密码为空。设置密码为root

[root@localhost /]# mysql -h localhost -u root
mysql> grant all on *.* to 'root'@'%' IDENTIFIED BY 'root' with grant option;
mysql> flush privileges;

默认的数据文件目录:/var/lib/mysql


你可能感兴趣的:(Linux下安装mysql)