This is an old revision of the document!
# 常用操作
## 创建用户
```sql create user '<username>'@'%' identified by '<password>'; ```
## 创建数据库
```sql create database <database_name>; ```
## 用户授权
```sql -- 授予所有数据库的所有权限 grant all privileges on *.* to '<username>'@'%'; -- 授予单个数据库的所有权限 grant all privileges on <database_name>.* to '<username'@'%'; ```
# 常见问题与解决方案
## 远程连接数据库提示111 Connection refused.
需要修改mysql配置文件,注释掉bind-server=127.0.0.1启用远程连接。Ubuntu下,MySQL配置文件路径`/etc/mysql/mysql.conf.d/mysqld.cnf`,MariaDB配置文件路径`/etc/mysql/mariadb.conf.d/50-server.cnf`