Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffsmonteiro/851ec7d792d2a8c36af8685baf92db98 to your computer and use it in GitHub Desktop.
Save jeffsmonteiro/851ec7d792d2a8c36af8685baf92db98 to your computer and use it in GitHub Desktop.
sudo apt purge mysql-client-8.0 mysql-client-core-8.0 mysql-server mysql-server-8.0
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-mysql
sudo apt-get dist-upgrade
/* WARNING: THIS WILL DELETE ALL THE DATA INCLUDING YOUR DATABASES */
sudo rm -rf /var/lib/mysql
sudo rm -rf /var/lib/mysql-files/
sudo rm -rf /var/lib/mysql-keyring/
sudo rm -rf /etc/mysql/
/* REINSTALL */
sudo apt-get install mysql-server
sudo mysql_secure_installation
/* ERRORS */
ERROR: mysqld: Can't read dir of '/etc/mysql/conf.d/' (OS errno 2 - No such file or directory)
FIX: sudo mkdir /etc/mysql/conf.d/
FIX: sudo dpkg --configure mysql-server-8.0
/* FIRST LOGIN */
sudo mysql -u root
/* TO REMOVE SUDO FROM MYSQL ROOT ACCESS */
sudo mysql -uroot
--- IN MYSQL ----
SELECT User, Host FROM mysql.user;
DROP USER 'root'@'localhost';
CREATE USER 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
/* TO SET DEFAULT CHARSET, PASTE THE FOLLOW CODE INTO YOUR MY.CNF FILE */
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment