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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值