MySQL software includes mysql client. It is a text-based client for mysqld, a SQL-based relational database server.
Genreal syntax:
mysql -u {mysql-user} -p {mysql-password} -h {mysql-server}
Where,
- -u {mysql-user} : Specify MySQL user name. Use root only when connecting to local system.
- -p {mysql-password}: Specify password, Employ the specified password when connecting to the database server. If a password is not supplied, it will be requested interactively.
- -h {mysql-server}: Connect to the specified host (remote or local)
For example remote connect to MySQL server called mysql10.nixcraft.in and user vivek:
$ mysql -u vivek –h mysql10.nixcraft.in -p
Output
Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 to server version: 4.1.15-Debian_1-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!
- Email FAQ to a friend
- Printable version
- Rss Feed
- Last Updated: 3-28-06
{ 1 comment… read it below or add one }
Thanks it was really useful command