MySQL FAQs
FAQs Categories
Client Server Commands
Database Structure
Table Types or Storage Engines
Indexes
SQL Statements
Table Joins
Funtions and Operators
Tricky Select Queries
Speed Up Queries
Data Back Up
General Questions
Errors
1PLs Company - #1Payday.Loans Agency - Loans online and near me $100-$2500 (Same Day)
Powered by MySQL
 
Home / Client Server Commands / Question No: 91

How to connect mysql client program with MySQL Server from the command line?

Answer No: 91

mysql understands the standard command-line options for specifying connection parameters.  So to invoke mysql interactively from the command line, you have to specify any necessary connection parameters after the command name like mysql --user=user_name --password=password --host=host_name.  Take example:

shell> mysql --user=root --password=root --host=localhost

You can also use short forms:

shell> mysql -u root -proot -h localhost

You can also ask mysql providing a database name to select that database as the default database:

shell> mysql -u user_name -p -h host_name db_name

On Windows, you can do like this:

C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql  -u user_name -p -h host_name db_name

Related MySQL FAQs to the Above FAQ

What-are-MySQL-client-programs What are MySQL client programs?

What-are-MySQL-non-client-utilities What are MySQL non-client utilities?

What-is-mysql-client-program-and-how-to-run-it What is mysql client program and how to run it?

What-is-difference-among-mysqld-mysqladmin-mysqldump-mysqlimport-and-mysqlcheck What is difference among mysqld, mysqladmin, mysqldump, mysqlimport and mysqlcheck?

How-to-check-version-of-the-running-MySQL-Server How to check version of the running MySQL Server?

What-is----compress-or--C What is --compress or -C?

What-is-difference-among---defaults-file---defaults-extra-file-and---no-defaults What is difference among --defaults-file, --defaults-extra-file and --no-defaults?

What-is-difference-between-g-and-G-characters-in-mysql-client-program What is difference between \g and \G characters in mysql client program?

How-to-execute-statement(s)-directly-from-the-command-line How to execute statement(s) directly from the command line?

How-to-cancel-the-statement-in-mysql-client-program How to cancel the statement in mysql client program?

What-is-difference-between-Interactive-Mode-and-Batch-Mode-of-mysql-client What is difference between Interactive Mode and Batch Mode of mysql client?

How-to-run-SQL-script-files-in-mysql-client How to run SQL script files in mysql client?

How-to-execute-the-entire-script-file-regardless-of-errors-occurrence How to execute the entire script file regardless of errors occurrence?

What-does-STATUS-command-in-mysql-client What does STATUS command in mysql client?

How-to-know-MySQL-system-variables How to know MySQL system variables?

What-does-MySQL-use-its-port-by-default What does MySQL use its port by default?

What-does---safe-updates-option-in-mysql What does --safe-updates option in mysql?

What-is-sql-mode-in-MySQL-and-how-can-we-set-it What is sql mode in MySQL and how can we set it?

How-to-check-the-MySQL-running-mode How to check the MySQL running mode?

About FAQs: Recently Added FAQs

About MySQL FAQs: Site Map | Bookmark Us | Recommend this Site to Your Friend | Contact Us

Useful Links: Wikipedia.org | Oracle.com | w3schools.com | www.php.net | Github.com

© 2024  www.mysqlfaqs.net
All rights reserved.