主页 > InnoDB存储引擎 > 当你忘记mysql密码时,没准你可以这样做

当你忘记mysql密码时,没准你可以这样做

小牛教程 InnoDB存储引擎 2021年10月30日

Sometimes you can clobber your configuration. As such, it's easier to start over, as if the package had never been installed. In your case, we are looking at MySQL.

1. use Yum to Remove MySQL, like so:
$ yum remove mysql mysql-server
2. removed MySQL, and safely backup the configuration:
$ mv /var/lib/mysql /var/lib/mysql_old_backup
3. If you'd rather remove it
$ rm -vR /var/lib/mysql
4. Now we can safely reinstall MySQL, using the default configuration that is included in the package from the Official MySQL repository (we need wget to fetch the rpm that will update your repos):
$ yum install wget
5. Now download and install the repository:
$ wget http://repo.mysql.com/mysql-c... && rpm -ivh mysql-community-release-el7-5.noarch.rpm
6. Verify the repositories are installed:
$ ls -1 /etc/yum.repos.d/mysql-community*
7. install command
$ yum install mysql-server
8. If you ever need to set the password after using the script, use:
mysql -u root
9.Start and Stop the daemon like so:
systemctl start mysqld
广告位
标签: