1. flush privileges 修改mysql.user权限后刷新使用,不用重启数据库。记得每次更改mysql.user表后都要flush一下
2. vi /etc/my.cnf 修改port = 3306
3. 如何修改连接mysql的用户名和密码?
a. 若root账号原密码是123,更改为abc:
mysqladmin -uroot -p123 password abc
mysql -uroot -pabc
mysql>flush privileges;
b. 直接修改mysql.user里的User
mysql> select User, Host from user;
+------+-----------+
| User | Host |
+------+-----------+
| test | % |
| root | localhost |
+------+-----------+
2 rows in set (0.00 sec)
4. 远程连接mysql。如果用test用户,需要把test用户的Host设置为%
update user set Host='%' where user='test';
假设test的密码是123
a. 命令行连接
mysql -h192.168.4.199 -utest -p123
b. navicat for mysql连接: