"chown mysql:mysql /data/tmp" command
- by Mellon
I am on a Linux ubuntu machine with MySQL installed.
If there is a MySQL installation on a Ubuntu machine, I saw some people doing the following thing:
sudo chown mysql:mysql /data/tmp
I get confused, I know the meaning of the above command, which is to change the owner of /data/tmp to user 'mysql' and change the group of it to 'mysql' group.
But (my questions):
1. Why would one run the above command? If I create a table in my_db database, by default, there will be .frm, .MYD, and .MYI files (data files) be created automatically by MySQL under /var/lib/mysql/my_db/ . So, does the above command changes the default MySQL data directory to /data/tmp/ instead of /var/lib/mysql/my_db/?
Basically, I would like to know the purpose and effect of the above command. (better with examples)
2. Where does the 'mysql' owner and group come from? Does the installation of MySQL on a Linux machine automatically create the 'mysql' user and group? or People need to manually create a mysql account for the linux machine?