Mysql Command Line Client: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 8: Line 8:
mysql -u root -p
mysql -u root -p
</syntaxhighlight>
</syntaxhighlight>
Will challenge for password.


<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>

Revision as of 03:55, 30 March 2021

Internal

Connect

mysql -u root -p

Will challenge for password.

mysql -u root -p<password>

No space after -p.

The username and password can also be stored in ~/.my.cnf:

[client]
user = root
password = XXXXXXXX

Scripting Database Interaction

mysql -u root -p<password> < statements.sql

where statements.sql should contain SQL:

SELECT VERSION();
...