How To Reinstall MySQL v5.x On Linux

How To Reinstall MySQL v5.x On Linux

To reinstall MySQL version 5.x on a Linux system, you can follow these steps:

  1. Remove the existing MySQL installation:
$ sudo apt-get remove mysql-server mysql-client mysql-common
Sour‮:ec‬www.lautturi.com

This will remove the MySQL server, client, and common packages from the system.

  1. Remove any leftover configuration files and directories:
$ sudo rm -rf /etc/mysql /var/lib/mysql

This will delete the MySQL configuration files and directories from the system.

  1. Install the MySQL repository package:
$ wget http://repo.mysql.com/mysql-apt-config_0.8.15-1_all.deb
$ sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb

This will download and install the MySQL repository package, which will allow you to install MySQL from the official MySQL repositories.

  1. Update the package list:
$ sudo apt-get update

This will update the list of available packages from the repositories.

  1. Install MySQL version 5.x:
$ sudo apt-get install mysql-server-5.6

This will install the MySQL server package for version 5.6. Replace 5.6 with the version of MySQL that you want to install (e.g., 5.7, 8.0).

  1. Secure the MySQL installation:
$ sudo mysql_secure_installation

This will run the MySQL security configuration script, which will prompt you to set the root password, remove anonymous users, and disable remote root login.

  1. Start the MySQL server:
$ sudo systemctl start mysql

This will start the MySQL server service.

Keep in mind that the specific steps and commands for installing and configuring MySQL on a Linux system may vary depending on your Linux distribution and version. Consult the MySQL documentation or the man pages for your system for more information.

Created Time:2017-10-28 21:38:53  Author:lautturi