Showing posts with label Create mysql user for remote host log in. Show all posts
Showing posts with label Create mysql user for remote host log in. Show all posts

Friday, July 12, 2013

Create mysql user for remote host log in

Log into mysql server from remote host

I am showing you a method to create mysql user for remote login.

I am going to give it all privileges so be careful. The details should not be given in wrong hands.

Create a user using following commands. Select any username and any password of your choice.
mysql> GRANT USAGE ON *.* TO 'new-username'@'%' IDENTIFIED BY 'new-password';
Now run this command. Use same username and password which you used in above command.
mysql> GRANT ALL PRIVILEGES ON *.* TO 'above-username'@'%' IDENTIFIED BY 'above-password' WITH GRANT OPTION;
Restart mysql.

Suppose my username is elex and password is linuxamination. My system's IP is 192.168.1.7. Now another user of my LAN whose IP is 192.168.1.8 wants to connect to my system's mysql server.

The other user should open it's terminal and run following command.
# mysql -h 192.168.1.7 -u elex -p'linuxamination'

Now 1.8 is  logged into my mysql server. Since user elex has full privileges so 1.8 can update/drop any database.