1. yum -y install mysql-server成功最后提示:Installed:mysql-server.i386 0:5.0.77-4.el5_6.6Dependency Installed:mysql.i386 0:5.0.77-4.el5_6.6 perl-DBD-MySQL.i386 0:3.0007-2.el5 perl-DBI.i386 0:1.52-2.el5Complete!2. vim /etc/my.cnfold_passwords=1 ← 找到这一行,在这一行的下面添加新的规则,让MySQL的默认编码为UTF-8default-character-set = utf8 ← 添加这一行然后在配置文件的文尾填加如下语句:[mysql]default-character-set = utf83. chkconfig mysqld on 命令配置mysql随系统自启动4.chkconfig --list mysqld 查看配置结果mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off ← 如果2--5为on的状态就OK5. /etc/rc.d/init.d/mysqld start ← 启动MySQL服务6. mysql -u root ← 用root用户登录MySQL服务器,控制台显示:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.0.77 Source distribution7. set password for root@localhost=password('在这里填入root密码'); ← 设置root密码Query OK, 0 rows affected (0.01 sec)set password for root@cloud=password('在这里填入root密码'); ← 设置root密码Query OK, 0 rows affected (0.01 sec)set password for root@127.0.0.1=password('在这里填入root密码'); ← 设置root密码Query OK, 0 rows affected (0.01 sec)8. select user,host,password from mysql.user; ← 查看用户信息+------+-----------+------------------+| user | host | password |+------+-----------+------------------+| root | localhost | 435e5b2459c49408 || root | cloud | 435e5b2459c49408 || root | 127.0.0.1 | 435e5b2459c49408 || | localhost | || | cloud | |+------+-----------+------------------+5 rows in set (0.00 sec9. mysql> delete from mysql.user where user=''; ← 删除匿名用户Query OK, 2 rows affected (0.17 sec)10. exit ← 退出MySQL服务器11. mysql -u root ← 通过空密码用root登录ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) ← 出现此错误信息说明密码设置成功12. mysql -u root -p ← 通过密码用root登录Enter password: ← 在这里输入密码Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 9Server version: 5.0.77 Source distribution
yun install mysql_aliyun主机下安装配置mysql
最新推荐文章于 2022-09-24 19:02:46 发布