MySQL給新建用戶並賦予權限最簡單的方法


創建一個用戶:

create user 'oukele'@'%' identified by 'oukele';

 

提示下面所列出的信息的話,得刷新一下權限表

The MySQL server is running with the --skip-grant-tables option so it cannot execute this st...

步驟如下:

擴展學習

mysql 新建用戶並賦予遠程訪問權限

[root@demo /]# mysql -u root -p #登錄服務器數據庫

Enter password:123xxx

#1.創建一個新用戶 testuser 密碼為 testuserpass

CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'testuserpass';

 

#2.創建數據庫testDB

create database testDB;

 

#3.執行命令為testuser用戶添加使用testDB權限

grant all privileges on testDB.* to testuser@localhost identified by 'testuserpass';

 

#4.執行命令,為testuser用戶添加遠程訪問權限

GRANT ALL PRIVILEGES ON testDB.* TO 'testuser'@'%' IDENTIFIED BY 'testuserpass' WITH GRANT OPTION;

 

#5.刷新權限表

flush privileges;

參考的文章:

文章同步發布: https://www.geek-share.com/detail/2785397051.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM