1、安装MysqL服务器
yum -y install MysqL-server
2、装入service启动服务
/etc/rc.d/init.d/MysqLd start
3、设置MysqL服务开机自启动
chkconfig MysqLd on
如果不确定是否已设置成开机自启动,可通过如下命令查看
chkconfig --list MysqLd
(MysqLd 0:off 1:off 2:on 3:on 4:on 5:on 6:off) ← 如果2--5为on的状态就OK
4、查看当前MysqL版本信息
MysqL –version
vi /etc/my.cnf
在[client]下增加:
default-character-set=utf8
character-set-server = utf8
init_connect='set names utf8'
进入MysqL中查看当前编码
mysql>show variables like '%character%';
6、设置访问权限和密码
MysqL> grant all privileges on *.* to 'root'@'%' identified by 'root';
MysqL> grant all privileges on *.* to 'root'@'localhost' identified by 'root';
MysqL> flush privileges;
可通过以下代码查看当前已经设置的访问权限状态
7、重启MysqL服务
/etc/init.d/MysqLd restart
8、彻底卸载MysqL
yum remove MysqL MysqL-server MysqL-libs compat-MysqL51
rm -rf /var/lib/MysqL
rm /etc/my.cnf
查看是否还有MysqL软件