MySQL is an open source RDBMS that supports all platforms like Unix, Windows and Linux. MySQL is mostly associated with web apps and online publishing. MySQL can be used to a wide range of applications as the working model is a client-based server.
There would be situations where the MySQL database server would crash and the following steps helps you to restore the MySQL database server –
Step 1: Login to server as a root user
Step 2: Backup the current MySQL folder from /var/lib/mysql to /var/lib/backup.mysql
# mv /var/lib/mysql /var/lib/backup.mysql
Step 3: Install MySQL 8.0
# wget -c https://repo.mysql.com//mysql-apt-config_0.8.13-1_all.deb
#sudodpkg -i mysql-apt-config_0.8.13-1_all.deb
Step 4: Installation of update package index on your server with apt
# apt update
Step 5: The next step is to install default MySQL server packages
# apt install mysql-server
Step 6: Shutdown MySQL server
@systemctl stop mysqld
Step 7: Copy important database folders from /var/lib/backup.mysql/<database name> to /var/lib/mysql/<database name>
Step 8: Copy ibdata1 file from /var/lib/backup.mysql to /var/lib/mysql
Step 9: Ensure all files and folders are owned by MySQL
drwxr-xr-x. 4 mysqlmysql 4096 Oct 24 2016mysql
Step 10: Restart the MySQL service
# systemctl start mysqld
At Velan, our server support engineers can help you restore or reinstall MySQL server. We troubleshoot problems like these for our clients every day. If you are interested in our service, please fill the Quick connect form to get in touch with us.