I have wamp installed , I want to know how to create username and password in mysql.
This question is related to
phpmyadmin
Previous answers might not work for later mysql versions. Try these steps if previous answers did not work for you:
Click on the wamp icon &rarr: mysql → mysql console
write following commands, one by one
use mysql;
update user set authentication_string=password('your_password') where user='root';
FLUSH PRIVILEGES;
quit
By default, you can access your databases at http:// localhost/phpmyadmin using user: root and a blank password.
Once logged in PHPmyAdmin, click on the Privileges tab. and on the Add a new user link located under the User Overview table
Hit enter as there is no password. Enter the following commands:
mysql> SET PASSWORD for 'root'@'localhost' = password('enteryourpassword');
mysql> SET PASSWORD for 'root'@'127.0.0.1' = password('enteryourpassword');
mysql> SET PASSWORD for 'root'@'::1' = password('enteryourpassword');
That’s it, I keep the passwords the same to keep things simple. If you want to check the user’s table to see that the info has been updated just enter the additional commands as shown below. This is a good option to check that you have indeed entered the same password for all hosts.
Use http://localhost/sqlbuddy --> users
interface.
You can find it at the localhost main page at Your Aliases
section.
Go to phpmyadmin and click on the database you have already created form the left side bar. Then you can see a privilege option at the top.. There you can add a new user..
If you are not having any database yet go to phpmyadmin and select databases and create a database by simply giving database name in the filed and press go.
WAMP Server – MySQL – Resetting the Root Password (Windows)
Log on to your system as Administrator.
Click on the Wamp server icon > MySQL > MySQL Console
Enter password: LEAVE BLANK AND HIT ENTER
mysql> UPDATE mysql.user SET Password=PASSWORD(‘MyNewPass’) WHERE User=’root’; ENTER Query OK
mysql>FLUSH PRIVILEGES; ENTER mysql>quit ENTER mysql>bye
Edit phpmyadmin file called “config.inc.php” enter ‘MyNewPass’ ($cfg['Servers'][$i]['password'] = ‘MyNewPass‘;)
Restart all services
Clear all cookies – I got the No password error and it was because of the cookies. (ERROR 1045: Access denied for user: ‘root@localhost’ (Using password: NO))
Just login into http://localhost/phpmyadmin/
with username:root
password:
with blank password. And then choose users account.And then choose add user account.
Go to http://localhost/phpmyadmin and click on the Privileges tab. There is a "Add a new user" link.
You can create a user using MySQL
like this:
CREATE USER 'username'@'servername' IDENTIFIED BY 'password';
and if you want to do that for a specific database, simply you can write in the MySQL
:
GRANT ALL PRIVILEGES ON database_name.*
TO 'username'@'servername'
IDENTIFIED BY 'password';
Note that it's all one sentence, also note that you need to change:
database_name // your database name
username // any name you want to use as username
servername // the name of your server, for example: localhost
password // any text you want to use as user password
Simply goto MySql Console.
If using Wamp:
That's it. This set your root password to secret
In order to set user privilege to default one:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
Works like a charm!
Here is the MySQL documentation on creating new user accounts.
In short, you create a user by running a CREATE USER
statement:
CREATE USER "<username>" IDENTIFIED BY "<password>";
Once the user is created, you give him access to do things by using the GRANT
statement.
Source: Stackoverflow.com