Operate mysql from command line

Use mysql using command line :

First install mysql client using command line.
apt-get install mysql-client or yum install mysql-client according to your Linux distribution.

Now go on mysql prompt using
$ mysql -h

If you want to log-in with root using command line
$ mysql -h -u root

Root's password is blank. If it asks for password, do not write anything, just press Enter key.

$ mysql -h -u root -p

Do not try to log-in with password protected user using command line.

If you try to log-in with password protected user, it gives following error :
ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES) 

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...