跳转至

MySQL

Database

# 创建数据库
CREATE DATABASE mydatabase CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

创建用户

1
2
3
4
5
6
7
8
# 创建用户
CREATE USER 'username'@'172.16.%' IDENTIFIED BY 'password';

# 授权
GRANT SELECT, INSERT, UPDATE, DELETE ON `dbname`.* TO 'username'@'172.16.%'

# 授予管理员权限
GRANT ALL PRIVILEGES ON *.* TO 'username'@`172.16.%`;

使用

# 截取字符串
SELECT CHAR_LENGTH("Have_a_good_day") - LOCATE('_', REVERSE("Have_a_good_day"))+1;
作者: aisuhua