Creating Mysql databse Users and changing Password using shell

Create a new user.
INSERT INTO [table name] (Host,User,Password) VALUES(‘%’,’user’,PASSWORD(‘password’));

Change a users password.(from unix shell).
mysqladmin -u root -h -p password ‘new-password’

Change a users password
SET PASSWORD FOR ‘user’@’hostname’ = PASSWORD(‘passwordhere’);

Allow the user “karthick” to connect to the server from localhost using the password “passwd123”

grant usage on *.* to karthick@localhost identified by ‘passwd123’;

grant all privileges on databasename.* to username@localhost;

Leave Your Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.