1.安装:#yum -y install mysql-server
2.修改配置:#vi /etc/my.cnf
暂时修改一下编码(添加在密码下方添加): default-character-set = utf8
3.启动mysql服务,并设定为系统服务:
# chkconfig mysqld on ← 设置MySQL服务随系统启动自启动
# chkconfig –list mysqld ← 确认MySQL自启动mysqld 0:off 1:off 2:on 3:on
4:on 5:on 6:off ← 如果2–5为on的状态就OK
#service mysqld start ←启动服务(#
/etc/rc.d/init.d/mysqld start也可以)
4.修改root密码(默认密码为空):
# mysql -u root ← 用root用户登录MySQL服务器
select user,host,password from mysql.user; ← 查看用户信息
set password for root@localhost=password(‘在这里填入root密码’); ←
设置root密码
select user,host,password from mysql.user; ← 查看用户信息
exit ← 退出MySQL服务器
5.删除匿名用户:
delete from mysql.user where user=”; ← 删除匿名用户
select user,host from mysql.user; ← 查看用户信息
6.当前版本信息,日期和数据库:
sele