MySQL 筆記

用mysql client連接MySQL server

mysql -u root -p --port=3306

創建新用戶 create a new user

mysql> create user 'someuser'@'localhost' identified by 'somepassword';

創建新資料庫 create new database

mysql> create database some_db_name

賦予用戶使用權利 Grant privileges to a user

mysql> GRANT ALL PRIVILEGES ON database_name.* TO 'some_user'@'localhost';

Show users

SELECT User, Host, FROM mysql.user;

參考資料

MySQL功能非常齊全,每個命令都有很多細節,本文只收集一下基本用法,更多可以看這個網頁和官方文檔。

Leave a Comment

Your email address will not be published.