How do I create a new MySQL user in XAMPP? Also, can I delete the existing “root” user?
3 Answers
It's too late but I'm sure my answer will help the community.
- To create a new mysql user in XAMPP you need to type the following commands:
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.
- To delete MySql user definitively you should run this command
DELETE FROM mysql.user
WHERE user = 'root'
AND host = 'localhost';
Hope that it's helpful.

- 1,389
- 2
- 16
- 21
-
Thanks, Felix. That's great info. Welcome aboard :-) – Mawg says reinstate Monica May 20 '19 at 06:34
XAMPP
sudo /opt/lampp/bin/mysql -u root -p
Enter Your Super Secret Password
CREATE USER 'UserName'@'localhost' IDENTIFIED BY 'UR@Secret@Password';
GRANT ALL PRIVILEGES ON * . * TO 'UserName'@'localhost';
FLUSH PRIVILEGES;
Native MySQL Client (Not XAMPP / LAMPP)
sudo mysql -u root -p
Enter Your Super Secret Password
CREATE USER 'UserName'@'localhost' IDENTIFIED BY 'UR@Secret@Password';
GRANT ALL PRIVILEGES ON * . * TO 'UserName'@'localhost';
FLUSH PRIVILEGES;

- 1
- 2
For me below configuration worked. Its for LAMPP:
-Create a new database named "dvwa" from http://localhost/phpmyadmin/index.php.
-And then inside DWVA nano config.inc.php file. Make "db_password field" empty. (ex. '').
-restart the apache as well as mysql from xampp

- 55
- 1
- 10