centos 6.5 编译安装 mysql 5.5.40
# mysql #使用客户端登录Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.40-log Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
#查看一下默认存在的用户
mysql> select user,password,host from mysql.user;
+------+----------+-----------+
| user | password | host |
+------+----------+-----------+
| root | | localhost |
| root | | diguojin|
| root | | 127.0.0.1 |
| root | | ::1 |
| | | localhost |
| | | diguojin|
+------+----------+-----------+
6 rows in set (0.00 sec)
mysql>
#删除默认存在的账户, 要求用户只能从本地服务器访问数据库
mysql> delete from mysql.user where host!='localhost';
Query OK, 4 rows affected (0.00 sec)
#修改root管理员账号密码
mysql> update mysql.user set password=PASSWORD('p@ssw0rd') where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1Changed: 1Warnings: 0
#更新数据库
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
#看一下修改后的结果
mysql> select user,password,host from mysql.user;
+------+-------------------------------------------+-----------+
| user | password | host |
+------+-------------------------------------------+-----------+
| root | *D7E39C3AF517EC9EF7086223B036E0B4F22821F8 | localhost |
| | | localhost |
+------+-------------------------------------------+-----------+
2 rows in set (0.00 sec)
mysql> \q
Bye
#
页:
[1]