Setting password in mysql account


1.       How to get into mysql command prompt?
a)      You need to find where does mysql.exe file resides and navigate to that location. Incase if you have installed wampserver then you can find it at
“C:\wamp\bin\mysql\mysql5.1.53\bin”
b)      Traverse through location using cd command. Then type mysql.

2.       Login to mysql with command prompt with password
mysql –u root –p

3.       How to set mysql to ‘No Password’
use mysql;
update user set password=null where User='root';
flush privileges;
quit;

4.       Create a password for the 'root' mysql account...
shell> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');


5.       Create a new user
Mysql> Create User ‘newuser’@’localhost’ IDENTIFIED BY ‘password’;

6.       How to set password to a user (if no password is set)
a)      Login to mysql with the user
   mysql –u root –p
b)      Type as set password = password('Test');

7.       If any of the internal tables are updates it’s preferred to execute below statement
        mysql> FLUSH PRIVILEGES;

8.       Granting access for a user to a specific database
         GRANT SELECT,INSERT,UPDATE,DELETE ON .* TO 'custom'@'localhost';







No comments:

Post a Comment