mysql用户相关操作
创建用户
mysql> CREATE USER 'demo'@'%' IDENTIFIED BY 'demo123';
> OK
> 时间: 0.308s
给新用户授权访问指定数据库
mysql> GRANT ALL PRIVILEGES ON demodb.* TO 'demo'@'%';
> OK
> 时间: 0.012s
刷新mysql权限
mysql> FLUSH PRIVILEGES;
> OK
> 时间: 0.036s
mysql登录
[root@demo ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2066
Server version: 8.0.37 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
修改用户密码
alter user root identified by '123456';
正文到此结束
- 本文标签: mysql
- 本文链接: https://codeis.run/article/mysql-user
- 版权声明: 本文由醒醒原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权