I recently installed MySql Server 8.0.19 on and EC2 (t2.micro) instance running Ubuntu 18.04.

I'm trying to find the MySql configuration file that's like the my.ini on Windows.

I've looked through almost every file in /etc/mysql/ but none of them are similar to the my.ini that windows uses. Where is this file located on Ubuntu 18.04 and where are the configuration settings read from?

  • So , where are the default values stored and read from? Like port, bind-address etc. – Norman Feb 13 at 15:06
  • @singrium he is asking about an EC instance. Those use a different method :) – Rinzwind Feb 13 at 15:13
  • @Rinzwind, sorry I didn't notice that. Thank you for the correction :) and thank you for your answer – singrium Feb 13 at 15:14

Do an update of the locate database and search for my.cnf

sudo locatedb
locate my.cnf

The 2 likely places are


That is the GENERIC method of finding files on a server.

But ...

EC2 instance

That does not use a generic configuration. The name depends on the type of instance: my-small.cnf, my-medium.cnf, my-large.cnf. Use that for the locate.

Mind also that EC settings often need to be done from within the console and not on command line!

  • I've looked through /etc/mysql/my.cnf, which finally points to /var/mysql/mysql.conf.d/mysqld.cnf which only has [mysqld] pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql log-error = /var/log/mysql/error.log So where is it getting the values for long_query_time etc? – Norman Feb 13 at 15:36
  • You did not find one of my-small.cnf, my-medium.cnf, my-large.cnf? Please edit the question to include what the type is of the instance. I would start with the EC2 console; that is where I mosttimes see these things happen. It is totally possible that this is done in memory and not on-disk. (we have EC2 instances and have a my-large.cnf but the file is in a virtual directory). – Rinzwind Feb 13 at 15:41
  • Instance type is t2.micro – Norman Feb 13 at 15:44

The default location should be /etc/mysql

Try searching for my.cnf find -name my.cnf or locate my.cnf from the root directory.

New contributor
IAMEng is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.