MySQL 資料庫 相關常用指令
MySQL資料庫 常用指令 # 登入 shell> mysql -u root -p # 顯示max_allowed_packet參數值 mysql> select @@global.max_allowed_packet, @@session.max_allowed_packet; # 顯示使用者 mysql> select host, user, password from mysql.user; # 設定log mysql> SET GLOBAL general_log = 'ON'; mysql> SET GLOBAL slow_query_log = 'ON'; #創建使用者 mysql> create user 'root'@'localhost' identified by 'password'; #顯示User mysql> SELECT User,Host FROM mysql.user; #移除權限 mysql> revoke all privileges on *.* from 'root'@'127.0.0.1'; #刪除使用者 mysql> drop user 'root'@'127.0.0.1'; #更改密碼 mysql> set password=password('password'); #更改別人密碼 mysql> set password for 'jik'@'localhost' =password('123'); #顯示權限 mysql> SHOW GRANTS FOR 'root'@'localhost'; #給予所有權限(root) mysql> Grant All Privileges On *.* To root@localhost Identified By 'password' With Grant Option; #給予特定權限 GRANT ALL PRIVILEGES