CyberPanel gives an intuitive interface to host your sites. It utilizes MariaDB and requires root user to make database schemas and database users. Sometimes, you change MySQL root password and in that case you need to update the same into CyberPanel configuration so that you are able to find CyberPanel MySQL Root Password.
Finding Mysql Root Password in Cyberpanel
Apparently, CyberPanel puts MySQL root password into two files:
- /etc/cyberpanel/mysqlPassword
- /usr/local/CyberCP/CyberCP/settings.py
1. Update MySQL Root Password in Mysqlpassword File
This file contains MySQL root password. You have to open the file into your favorite editor and update it with the new root password.
2. Update MySQL Root Password in Settings.py File
This file contains Django settings. It own a section for database schema and the user details. You have to open this file and update the root password in the Databases section.
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'cyberpanel', 'USER': 'cyberpanel', 'PASSWORD': 'Q02PhIk8rKYwnJ', 'HOST': 'localhost', 'PORT': '', }, 'rootdb': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'mysql', 'USER': 'root', 'PASSWORD': 'qwerty2022', 'HOST': 'localhost', 'PORT': '', }, }
The mysql database schema is utilized by the MySQL server. It holds all the users and their privileges details. The cyberpanel database is utilized by the CyberPanel software. If you change the cyberpanel user password in the MySQL server, so you are able to change it in this file.
3. Restart the CyberPanel Service
# systemctl restart lscpd.service
That is it. We have updated the root password in the CyberPanel successfully. You are able to login to the CyberPanel dashboard and make a test database to confirm it. For note: If you have /home/cyberpanel/.my.cnf file present, then you are able to update the root password there.
Changing MySQL Server Port in CyberPanel
By default, MySQL runs on 3306 port. However, if you are changing it for some reason, so you need to inform CyberPanel about it too. Please update the new port number in the /usr/local/CyberCP/CyberCP/settings.py file Databases section and then restart the CyberPanel service.
Resetting The MySQL Root Password
In addition, here we also want to explain how to reset the MySQL root password. You will need to do this, for instance if you have forgotten your password. Remember that you have to own root access on the server for resetting the MySQL root password.
To reset the root password for MySQL, please follow these steps below:
- Firstly, log in to your account using SSH.
You have to run the commands in this step as the root user. So, you are able to log in directly as the root user (that is not recommended for security reasons), or use the su or sudo commands to run the commands as the root user.
- Then, you have to stop the MySQL server by using the appropriate command for your Linux distribution:
For CentOS and Fedora, type: service mysqld stop
For Debian and Ubuntu, type: service mysql stop
- After that, you are able to restart the MySQL server with the skip-grant-tables option. To do that, type the command below:
mysqld_safe –skip-grant-tables &
- Please ensure that you type the ampersand at the end of the command. This will runs the command in the background and lets you to type the commands in this steps. For your information, running MySQL with the skip-grant-tables option is highly insecure, and should only be done for a brief period while you reset the password.
- Now, log into MySQL using the command below:
mysql
- At the mysql> prompt, you are able to reset the password. To do that, just type the command below, and replace new-password with the new root password:
UPDATE mysql.user SET Password=PASSWORD(‘new-password’) WHERE User=’root’;
- At the mysql> prompt, please type the commands below:
FLUSH PRIVILEGES;
exit;
- Please stop the MySQL server by using the command below. You are going to be prompted to submit the new MySQL root password before the MySQL server shuts down:
mysqladmin -u root -p shutdown
- Afterwards, start the MySQL server normally. To do that, just type the appropriate command for your Linux distribution:
For CentOS and Fedora, type: service mysqld start
For Debian and Ubuntu, type: service mysql start
CyberPanel Control Panel is one of the best free Control Panel that available now. Easily, you are able to install Cyberpanel on your VPS or Server. Cyberpanel is powered by Litespeed webserver. You will be able to use up to 2gb ram VPS or server free with LiteSpeed enterprise directly from Litespeed. Actually, Cyberpanel is a completely free edition control panel from Litespeed. You are able to use many modules to optimize your server. For your information, caching is one of the best optimizations on this web panel.
Also, Cyberpanel installation is super easy. Easily, you are able to install Memcached and Redis right from the beginning. You will need to run a command on ssh and then automatically it will start the installation for you. Please take a look at the minimum server Requirement for Cyberpanel installation.
CyberPanel installation Requirements:
-
- Ubuntu 18.04, Ubuntu 20.04, Centos 7.x, Centos 8.x
- Python 2.7
- 1024 MB or above Ram.
- 10 GB Disk Space.
Well, this is the minimum requirement to install CyberPanel on your VPS/ server. It is a super lightweight control panel, so you do not have to worry about your server or VPS optimization.
To install the base version of CyberPanel, simply you are able to log in to your VPS via SSH as the root user. Then, run the command below that will automatically download and run the CyberPanel install script:
sh <(curl https://cyberpanel.net/install.sh || wget -O – https://cyberpanel.net/install.sh)
Next, follow the on-screen prompts to proceed through selecting what version of LiteSpeed you want to be installed, selecting what additional modules you want to be installed and setting the admin password. After the installation has completed, you are going to be presented with the installation details for being able to access CyberPanel through a web browser.
AUTHOR BIO
On my daily job, I am a software engineer, programmer & computer technician. My passion is assembling PC hardware, studying Operating System and all things related to computers technology. I also love to make short films for YouTube as a producer. More at about me…
Leave a Reply