linux安装 mysql

1、安装mysql客户端:
yum install mysql

2、安装mysql 服务器端:
yum install mysql-server
yum install mysql-devel

3、数据库字符集设置
mysql配置文件/etc/my.cnf中加入character-set-server=utf8
4、Mysql自启动
chkconfig --add mysql        添加服务
查看开机启动设置是否成功chkconfig --list | grep mysql*
如果看到mysql的服务,并且3,4,5都是on的话则成功,如果是off,则键入
chkconfig --level 345 mysql on
5、开启远程访问
use mysql;
update user set host = '%' where user = 'root';//将root用户的host改成%
6、开放端口
vi /etc/sysconfig/iptables
添加
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
service iptables restart

7、启动、停止mysql
service mysqld start
service mysqld stop

猜你喜欢

转载自bhdweb.iteye.com/blog/2171004
今日推荐