linux中怎样设置mysql用户名和密码

如题所述

1.登录mysql

# mysql -u root -p

然后输入密码

2.使用mysql 数据库

use mysql;

3.添加一个用户 test 并授权通过本地机(localhost)访问,密码"password"。

grant all privileges on *.* to test@localhost identified by 'password' with grant option;

4. 刷新刚才的内容*

flush privileges;

5.查看用户

select host,user from mysql.user;

温馨提示:答案为网友推荐,仅供参考
相似回答