在 XAMPP 中创建一个新的 MySQL 用户

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5986635/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 19:52:29  来源:igfitidea点击:

Create a new MySQL user in XAMPP

mysqlxampp

提问by Mawg says reinstate Monica

How do I create a new MySQL user in XAMPP? Also, can I delete the existing “root” user?

如何在 XAMPP 中创建新的 MySQL 用户?另外,我可以删除现有的“root”用户吗?

回答by Félix Maroy

It's too late but I'm sure my answer will help the community.

为时已晚,但我相信我的回答会对社区有所帮助。

  1. To create a new mysql user in XAMPP you need to type the following commands:
  1. 要在 XAMPP 中创建新的 mysql 用户,您需要键入以下命令:
mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
\q

This command grants the user all permissions.For more information about setting MySQL database permissions, please visit https://dev.mysql.com/doc/refman/5.5/en/grant.html.

此命令授予用户所有权限。有关设置 MySQL 数据库权限的更多信息,请访问https://dev.mysql.com/doc/refman/5.5/en/grant.html

  1. To delete MySql user definitively you should run this command
  1. 要明确删除 MySql 用户,您应该运行此命令
DELETE FROM mysql.user 
WHERE  user = 'root' 
     AND host = 'localhost';

Hope that it's helpful.

希望它有帮助。

回答by adarsh kavtiyal

For me below configuration worked. Its for LAMPP:

对我来说,下面的配置有效。对于 LAMPP:

-Create a new database named "dvwa" from http://localhost/phpmyadmin/index.php.

- 从http://localhost/phpmyadmin/index.php创建一个名为“dvwa”的新数据库。

-And then inside DWVA nano config.inc.php file. Make "db_password field" empty. (ex. '').

-然后在 DWVA nano config.inc.php 文件中。将“db_password 字段”设为空。(前任。 '')。

-restart the apache as well as mysql from xampp

- 从 xampp 重启 apache 和 mysql