Last active
July 27, 2021 06:48
-
-
Save zhum/0337fb91cc7d3553d42b14aa9619896f to your computer and use it in GitHub Desktop.
Reset password fro ANY mysql/mariadb installation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PASSWORD RESET | |
#!/bin/sh | |
service mysql stop | |
sudo mysqld_safe --skip-grant-tables & | |
mysql_secure_installation | |
mysql -u root -p shutdown | |
service mysql start | |
########################################### | |
# Fix error like 'nnoDB: Error: Attempted to open a previously opened tablespace. Previous tablespace mysql/innodb_index_stats uses space ID' | |
# | |
# 1. vi /etc/mysql/conf.d/mysql.cnf | |
# 2. add to [mysql] section: 'innodb_force_recovery = 1' | |
# 3. start mysql | |
# 4. If still fails, go to /var/lib/mysql, find relevant *.ibd files and BACKUP them (delete originaks). | |
# 5. start mysql | |
# 6. if ok, wait, stop mysql, delete 'innodb_force_recovery = 1' and start mysql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment