mysql 用户
Last updated on November 20, 2024 am
🧙 Questions
☄️Ideas
创建用户
-- 查询mysql上的所有用户
-- SELECT DISTINCT (User) FROM mysql.user;
CREATE USER IF NOT EXISTS 'ispong'@'%' Identified BY 'ispong123';
赋予权限
-- 查看用户权限
-- SELECT * FROM mysql.user where User='yan' and Host='%'
-- 创建数据库
CREATE DATABASE IF NOT EXISTS ispong_db DEFAULT CHARSET utf8mb4;
GRANT ALL PRIVILEGES ON ispong_db.* TO 'ispong'@'%';
Flush Privileges;
赋予查询权限
-- grant SELECT,CREATE,INSERT on ispong_db.* to 'ispong'@'%';
GRANT ${PRIVILEGES} on ${databaseName}.* to '${user}'@'%';
赋予密码登录方式
SELECT user, host, plugin from mysql.user;
ALTER USER 'ispong2'@'%' IDENTIFIED WITH mysql_native_password BY 'ispong2022';
修改密码
-- 更新密码
use mysql;
update user set password=password("Gsw921226.") where user="root";
flush privileges;
删除用户
DROP USER 'repl'@'%';
🔗 Links
mysql 用户
https://ispong.isxcode.com/db/mysql/mysql 用户/