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、创建用户并授权

创建一个允许远程登录的管理用户weihu,并允许对所有数据库进行任何操作:

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>

你可能感兴趣的:(mysql,mysql,数据库,oracle)