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.