Linux下输入命令:
mysql -uroot -proot123
进入mysql后输入:
查看目前有哪些数据库存在:
mysql> SHOW DATABASES;
创建数据库:create schema [数据库名称] default character set utf8 collate utf8_general_ci;
例子:
mysql> create schema estuntest default character set utf8 collate utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
创建用户:create user ‘[用户名称]‘@‘%‘ identified by ‘[用户密码]‘;
例子:
mysql> create user ‘estuntest‘@‘%‘ identified by ‘estuntest123‘;
Query OK, 0 rows affected (0.00 sec)
用户授权数据库:grant select,insert,update,delete,create on [数据库名称].* to [用户名称];
*代表整个数据库.
例子:
mysql> grant select,insert,update,delete,create on estuntest.* to estuntest;
Query OK, 0 rows affected (0.00 sec)
时间: 2024-12-28 17:20:54