Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Give .my.cnf to mysql command line

How to give a specific .my.cnf config file to the mysql command line?

 $ mysql --my-config=.my.cnf 
like image 435
Philippe Blayo Avatar asked Sep 20 '12 12:09

Philippe Blayo


People also ask

How can I create my CNF file in MySQL?

Try: nano /etc/mysql/my. cnf and put these values. Where DBUSERNAME, DBPASSWORD, DBSERVER and DBNAME should be replaced with your own correct database username, database hostname, database name and database password. You will not have any of these until you create a database through your Control Panel.

How do I get to MySQL command line?

Enter mysql.exe -uroot -p , and MySQL will launch using the root user. MySQL will prompt you for your password. Enter the password from the user account you specified with the –u tag, and you'll connect to the MySQL server.


1 Answers

The --defaults-file option lets you specify which options file you want to use. It would be a good idea to give it the full path to your options file.

mysql --defaults-file=/home/user/.my.cnf database 
like image 156
Brian Showalter Avatar answered Sep 21 '22 21:09

Brian Showalter