登录
首页 >  数据库 >  MySQL

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

来源:SegmentFault

时间:2023-01-20 11:03:28 170浏览 收藏

小伙伴们有没有觉得学习数据库很有意思?有意思就对了!今天就给大家带来《当你忘记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

好了,本文到此结束,带大家了解了《当你忘记mysql密码时,没准你可以这样做》,希望本文对你有所帮助!关注golang学习网公众号,给大家分享更多数据库知识!

声明:本文转载于:SegmentFault 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>
评论列表