Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a new MySQL user in XAMPP

Tags:

mysql

xampp

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

like image 946
Mawg says reinstate Monica Avatar asked May 13 '11 02:05

Mawg says reinstate Monica


People also ask

How do I create a new user in MySQL?

MySQL CREATE USER ExampleStep 1: Open the MySQL server by using the mysql client tool. Step 2: Enter the password for the account and press Enter. Step 3: Execute the following command to show all users in the current MySQL server. Step 4: Create a new user with the following command.

What is XAMPP MySQL username and password?

Open phpMyAdmin in XAMPP. The phpMyAdmin interface. If you're asked to log in, use the username “root” and enter your root password. If you haven't set one yet, you can leave it blank.


2 Answers

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:
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.

  1. 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.

like image 87
Félix Maroy Avatar answered Oct 09 '22 04:10

Félix Maroy


The MySQL documentation is very good: http://dev.mysql.com/doc/refman/5.1/en/create-user.html

Securing your new installation: http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html

like image 41
Joshua Martell Avatar answered Oct 09 '22 02:10

Joshua Martell