cyberpanel

Install CyberPanel Control Panel

Now you can start CyberPanel Control Panel Installation by running the following command:

cd /usr/local/src && wget https://cyberpanel.net/install.sh && sh install.sh

ySQL root password:
To find out the password of your MySQL root, use the following command:

more /etc/cyberpanel/mysqlPassword

If you want to change your MySQL root password at anytime, you can do that by using the command below:

nano /etc/cyberpanel/mysqlPassword

Change the password, save the file and exit. You will also need to update the password in the settings file that is located at /usr/local/CyberCP/CyberCP/settings.py file under rootdb entry by using the command below:

nano /usr/local/CyberCP/CyberCP/settings.py

Once done, run the following command:

systemctl restart lscpd


mariadb.service - MariaDB database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: signal) since Thu 2018-10-11 07:44:04 CEST; 2s ago Process: 8550 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 8548 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS) Process: 8519 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=killed, signal=ABRT Process: 8402 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? Process: 8397 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 8395 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS) Main PID: 8519 (code=killed, signal=ABRT) Status: "Taking your SQL requests now..." Tasks: 0 (limit: 4915) Memory: 780.0K CPU: 1.212s



Solution

The database is broken for some issue. You will need to restore your backup or try to recover the error.

Step 1

Get the root password for your local database by typing:
cat /etc/mysql.secret
Use this password for the later commands (best by copy&paste).

Step 2

To recover, start the mysql database server in recovery mode by setting:
ucr set mysql/config/mysqld/innodb_force_recovery=1

Start server by
systemctl start mariadb

If the server now starts up and stays up you have to dump your databases in step 3. If it does not start up you have to increase the above value of 1 stepwise. Next, use 2, if it still does not start use 3 and so on. Maximum value supported is 6.
Note: Values of 4 or greater can permanently corrupt data files! Use at your own risk and only if you do not have a backup.

Step 3

As your server is now up and running in recovery mode dump your database:

mysqldump -h localhost --opt --lock-all-tables --triggers --routines --flush-logs -u root -p --all-databases --events > mysql.dump

And restore it immediately:

mysql -u root -p  < mysql.dump

This will fix possible index errors in the database and re-create all indexes.
In case you get an error as follows:
ERROR 1036 (HY000) at line 89: Table ‘entries’ is read only
with errors in the log files similar to these:
[ERROR] Can’t init tc log
do the following:

systemctl stop mariadb
mv /var/lib/mysql/tc.log /root/tc.log.bak

And then restart with step 2.
Note: The tc.log is needed for distributed transactions 2. Usually they are not used by any UCS/ Kopano/ Owncloud apps. You might want to verify this before removing the file.

Step 4

Restart Database in normal operation mode

Reset the recovery parameter by and restart database server:

ucr unset mysql/config/mysqld/innodb_force_recovery
systemctl restart mariadb

Step 5

If you did not succeed with the above steps you might have an error with InnoDB tablespaces. Check your /var/log/mysql/error.log for following lines:

2018-10-11 12:04:01 140018301646592 [ERROR] InnoDB: Failed to find tablespace for table '"mysql"."gtid_slave_pos"' in the cache. Attempting to load the tablespace with space id 3.

In this case you can try to recover the corrupt tablespaces without risk of data loss.

Step 5.1

Backup existing files in case something goes terribly wrong.

systemctl mariadb stop
cd /var/lib
tar czpvf ~/mysql_files.tar.gz mysql/

Step 5.2

Start database with the lowest recovery value possible (raise the level if needed step-by-step) to have your mysql server staying up stable.

ucr set mysql/config/mysqld/innodb_force_recovery=1  # try 2, 3, 4 ,5 ,6 in that order
systemctl start mariadb

Step 5.3

Enable files_per_table (by default on):

mysql -h localhost -u root -p -e "SET GLOBAL innodb_file_per_table=1"

Step 5.4

Drop the tablespace from the above referenced (Step 5) tables and re-import them.

mysql -h localhost -u root -p  -e "alter table mysql.gtid_slave_pos discard tablespace; show warnings;"
mysql -h localhost -u root -p  -e "alter table mysql.gtid_slave_pos import tablespace; show warnings"

Step 5.5

Try mysqldump if it succeeds.

ucr unset mysql/config/mysqld/innodb_force_recovery
systemctl restart mariadb
mysqldump -h localhost --opt --lock-all-tables --triggers --routines --flush-logs -u root - --all-databases --events > mysql.du





















Comments

Popular posts from this blog

cpanel exam CPSP Answers

How to install zimbra collaboration suite 8.8.11 on CentOS 7

awstats installation