MYSQL默认用户名root可以改的吗?

2025-05-09 17:33:53
推荐回答(5个)
回答1:

可以修改:
1、用root身份登入 进入mysql库 修改user表即可。
2、操作如下:
G:\phpStudy\MySQL\bin>mysql -uroot -proot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 391
Server version: 5.0.51b-community-nt-log MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql;
Database changed
mysql> update user set user='xly' where user='root';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> flush privileges;
mysql> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| xly | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| yxl | localhost | *23AE809DDACAF96AF0FD78ED04B6A265E05AA257 |
| xly | % | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+------+-----------+-------------------------------------------+
3 rows in set (0.00 sec)

回答2:

root用户名不可以改,只能修改相应密码,但不我知道你是出于什么目的要修改用户名?你就不可以创建新的用户吗?呵呵!

回答3:

可以改的。。
用root身份登入 进入mysql库 修改user表即可。
操作如下:
use mysql;

mysql>update user set user='newName' where user='root';

mysql> flush privileges;

回答4:

可以改,二楼解

回答5:

可以改,HI我!