Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of mariadb user Startup Mode using root under Linux

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you the "example analysis of the user startup mode of mariadb using root under Linux", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let me lead you to study and learn the "sample analysis of mariadb user startup mode of root under Linux".

Recently, due to the need of testing security products, I want to adjust the startup user of mariadb to root. After some twists and turns, I finally succeeded!

Note: starting mysql as root is a very dangerous behavior, which is equivalent to giving database users (database administrators or hackers) a channel to operate directly to the system through mysql!

In fact, root is not officially allowed to start, so under normal startup mode, root startup will return startup failure and prompt in / var/log/mariadb/mariadb.log

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

All right, let's get to the point about how Mariadb starts:

Ordinary people can operate: systemctl start mariadb

However, this instruction actually calls mariadb.service (specific directories are found by find) and executes the startup of mariadb.

Mariadb.service modifies the configuration as follows:

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

[Unit]

Slightly

[Service]

Type=simple

User=mysql is changed to User=root here | | the initiator of the service.

Group=mysql is changed to Group=root here | | Startup group of the service.

# script that initializes mysql library files. If the mysql directory is not empty, it will prompt Database Mariadb is probably initialized in / var/lib/mysql already and nothing is done. If you see this when troubleshooting, you can ignore it.

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

# execute the execution script of mysqld and do a security check. It is this file that restricts root to start

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

The following is a brief outline.

# systemctl demon-reload#systemctl restart mariadb

PS: the same operation mode allows mysql to be launched by other users

The permissions of the two directories BUT / var/lib/mysql / var/log/mariadb may need to be adjusted.

The above is all the contents of this article entitled "sample Analysis of mariadb user Startup Mode using root under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report