MySQLデータベースの構成の問題:MySQLを指定したアカウントにアクセスするための許可指定されたライブラリ

1.指定されたアカウントの管理者権限

grant all privileges on 数据库名.* to '账号名'@'%' identified by '账号密码';

# 示例:
'''
数据库名:shuchengyi
账号名:shucheng
密码:shucheng
'''
grant all privileges on shuchengyi.* to 'shucheng'@'%' identified by 'shucheng';

# 如要授权的账户未被创建则自动创建该账号

2.ユニットが接続されている場合のMySQLロム

# 就把账号授权的代码,用localhost替换%,本机就可以登录了
grant all privileges on shuchengyi.* to 'shucheng'@'localhost' identified by 'shucheng';

3.あなたが設定した後、リフレッシュする権限を持っている必要があります

flush privileges

4.アカウントのログインパスワードルフィルフィで開発、管理を終了します

mysql -ushucheng -pshucheng
show databases;  # 查看是否可见指定库,有则成功

おすすめ

転載: www.cnblogs.com/shuchengyi/p/11228264.html