I have encountered a problem when compiling and installing software in Linux, especially mysql. For example, I would like to know if mysql is compiled and installed to /data/server/mysql. According to this path, the final mysql directory should be the runtime utility permission or root permission of mysql, because the compilation and installation are performed under root permission. Therefore, in this case, the directories where the software was installed in the past are all root. when we first started to study compilation and installation, we tried to change this installation directory to the permissions of mysql’s running user, i.e. mysql results in the problem of mysql login. it is also possible that I made a mistake by mistake. however, in terms of this problem, I would like to make clear what permissions should be appropriate for the installation directory guiding compilation and installation of the software.
For example, if your mysqld process needs to read and write to /mysql/data directory, then you should ensure that the operating user of mysqld has read and write permissions to /mysql/data, which has nothing to do with which user you compile the program.
sudo scripts/mysql_install_db \ --user=png_mysql \ --defaults-file=/png/percona/5.6.23/etc/my.cnf \ --basedir=/png/percona/5.6.23 \ --datadir=/png/percona/5.6.23/data
The MySQL initialized in this way will automatically set the data directory permissions to: directory 700, file 660, owner png_mysql.