Tutorial - Cyberpanel MySQL Config and mysql root password file located | Vevioz Developers

Tutorial Cyberpanel MySQL Config and mysql root password file located

DevOps

Linux Systems Engineer
Joined
Oct 18, 2019
Messages
211
Reaction score
20
Points
18
Location
Novosibirsk, Russia
Website
addons.vevioz.com
Offline
SQL-880x560-1286560097-1.jpg

Of course any password that is stored in plain text is a bad idea but the location of the file is in /etc/my.cnf so if a remote user had access to that file I think there would be more things to worry about than having your mysql password stolen. On the other hand if you are not the only one who has physical access to the system then you are still safe from others reading your file since your file permissions are 400, assuming no one escalated privileges on the system. I did some research about having your password in my.cnf file and it's true it's actually a pretty common practice.

By the way you need to make sure you don't actually edit the file thats located in the /etc/my.cnf which mysql server uses to boot up because if you do anyone can use the server with ALL privileges and ALL databases without a password. So instead create a file in your local /root directory call it my.cnf and make sure only root can read it (of course)

The easiest way to do this is to use a client section of the ~/.my.cnf file, and add the credentials inside that file.

Code:
/etc/mysql/my.cnf

Code:
[client-server]
sql-mode=""

Before upgrading the server, remove sql-mode="" and restore it again after the upgrade is complete.

Cyberpanel mysql root password
Code:
/etc/cyberpanel/mysqlPassword

All changes must end with a restart
Code:
sudo service mysqld restart
 
Last edited:
Top Bottom