Martin.xu

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

mysql创建管理员账户

1、在本地使用root账户登入

[root@mysqldb ~]# mysql -h 127.0.0.1 -u root -p   
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.30 MySQL Community Server - GPL

Copyright (c) 2000, 2022, 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>

2、创建用户并授权

mysql> create user 'weihu'@'%' identified by 'weihu@123';
Query OK, 0 rows affected (0.10 sec)

mysql> grant all on *.* to 'weihu'@'%' with grant option;
Query OK, 0 rows affected (0.10 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.08 sec)

mysql>

 

posted on 2022-10-07 21:23  Martin.xu  阅读(370)  评论(0)    收藏  举报