mariadb under Linux root user startup mode

Recently, due to the need to test the safety of products, users want to adjust the start mariadb as root, After a lot of twists and turns finally succeeded!

Note: The start mysql as root is a very dangerous act, which is equivalent to the operation of the database user (database administrator or a hacker) a direct channel mysql system operated by!

The official launch is actually not allowed to root, so the root will start to return fails to start in general start-up mode, and you are prompted to /var/log/mariadb/mariadb.log in

Please consult the Knowledge Base to find out how to run mysqld as root!

 


Well, turn to the question, on Mariadb Start:

Most people will operate:  systemctl Start MariaDB

However, this directive is actually called  mariadb.service   (with a specific directory to find the find), performs mariadb start.

mariadb.service modified configuration is as follows:

# vi `find /usr -name 'mariadb.service' ` 

[Unit]

slightly

[Service]

Type=simple

User = mysql      here changed to   User = root      start of the service user ||  

Group = mysql    here changed to  Group = root       to start services group ||

 

# Script mysql database initialization file, if mysql directory is not empty it will be prompted Database Mariadb is probably initialized in / var / lib / mysql already, nothing is done, to see if this content is negligible troubleshooting

ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n           

 

# Execution script mysqld and do a security check, this is the start of the root file limit

ExecStart = / usr / bin / mysqld_safe  --basedir = / usr here to add parameters    --user = root       

 

The following slightly. . .

 

#systemctl demon-reload

#systemctl restart mariadb

 

PS: The same operation support mysql start to other users,

The BUT    / var / lib / MySQL / var / log / MariaDB access to both directory or the owner needs to be adjusted.

Guess you like

Origin www.cnblogs.com/caya-yuan/p/11898915.html