MySql 5.7 重置root密码
2024-10-01 20:39:19
一、以安全模式登录
# Stop MySQL
sudo service mysql stop
# Make MySQL service directory.
sudo mkdir -p /var/run/mysqld
# Give MySQL user permission to write to the service directory.
sudo chown mysql:mysql /var/run/mysqld
# Start MySQL manually, without permission checks or networking.
sudo mysqld_safe --skip-grant-tables &
# Log in without a password.
mysql -u root
二、修改密码
UPDATE mysql.user SET authentication_string=PASSWORD('NEW-PASSWORD'), plugin='mysql_native_password' WHERE User='root' ;
EXIT;
三、重启数据库
# Turn off MySQL.
sudo mysqladmin -S /var/run/mysqld/mysqld.sock shutdown
# Start the MySQL service normally.
sudo service mysql start
最新文章
- 玩转Asp.net MVC 的八个扩展点
- 【BZOJ 1468】Tree 点分治
- char*或string转换成LPCWSTR
- 【转载】solr初体验
- 揭开UTF-8的神秘面纱
- JS学习笔记(四) 正则表达式(RegExp对象)
- thinkphp用phpexcel读取excel,并修改列中的值,再导出excel,带往excel里写入图片
- Downloading the Google Cloud Storage Client Library
- Jetty开发(2)
- NOI 能量采集
- HDU2504 又见GCD
- unity中怎样获取全部子物体的组件
- 轻松学习之Linux教程一 ubuntu14.04+windows双系统安装
- 编程算法 - 数丑陋 代码(C)
- 新服务器sudo与权限分配<;NIOT>;
- iOS动画编程
- 一个action读取另一个action里的session
- RabbitMQ学习3----运行和管理RabbitMQ
- Django ORM 使用原生 SQL
- 【centos7】 Failed to start LSB Bring up/down
热门文章
- C# 二分法查找和排序
- CCPC2016长春站打铁记
- Global Git ignore - Stack Overflow
- [Angular] Using ngOnChanges lifeCycle hook to break object reference
- 【codeforces 755C】PolandBall and Forest
- Android Studio 连接自己搭建的server 须要admin 的帐号的问题 SSH Password Login,please enter password for user git@git.
- 如何快糙好猛的使用libfacedetection库【最新版】
- 《iOS开发全然上手——使用iOS 7和Xcode 5开发移动与平板应用》之Objective-C新手训练营
- 汉高澳大利亚matrix矩阵计算器
- Adaptive partitioning scheduler for multiprocessing system