Using Option Files .My.Cnf – Mysql User & Password


Warning!

If someone gains access to your account they will be able to easily escalate to root privileges.


Create file ~/.my.cnf and add the following lines in it and replace mysqluser & mysqlpass values.

[client]
user=mysql_user_name
password=mysql_password

For safety, make this file readable to you only by running chmod 0600 ~/.my.cnf

Purpose

Next time you run mysql commands mysqlmysqlcheckmysqdump, etc; they will pick username & password from this file if you do not provide them as argument (-u and -p). It can save your time.

Of-course, if you specify username and password explicitly as part of commands arguments, they will be used.

Share:

More Posts

March 2022 – Kids on the Yard PR

“I can relate to this! Parents having a very tough time keeping their kids educational on track…” Sarah Maruani, a first-grade teacher, has founded Kids

Happy smiling arab schoolgirl using phone for virtual online study at home.

Online Summer Camp 2022

Numerous schools are supplying online guideline to struggling visitors. Unfortunately, there is an absence of research study on the effect of online small-group analysis intervention,

Sign up for our newsletters

SEO

Book Now Free SEO Consultation

Commerce

Take your ecommerce site to next the level

Development

Website Development