最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

[转载]MySQL:ResetLostRootPassword_MySQL

来源:动视网 责编:小采 时间:2020-11-09 18:03:43
文档

[转载]MySQL:ResetLostRootPassword_MySQL

[转载]MySQL:ResetLostRootPassword_MySQL:bitsCN.com Here is a quick Step-by-Step “how to” which helps restoring MySQL root password that was lost/forgotten.It happens to everybody, especially if several distributed (different) systems are maintained, where the password
推荐度:
导读[转载]MySQL:ResetLostRootPassword_MySQL:bitsCN.com Here is a quick Step-by-Step “how to” which helps restoring MySQL root password that was lost/forgotten.It happens to everybody, especially if several distributed (different) systems are maintained, where the password


bitsCN.com

Here is a quick Step-by-Step “how to” which helps restoring MySQL root password that was lost/forgotten.

It happens to everybody, especially if several distributed (different) systems are maintained, where the password is not the same. Here is what needs to be done to restore it:

Step 1: Stop MySQL daemon if it is currently running

Depending on the operating system MySQL is installed on, the daemon can be checked/stopped differently. Here is an example on how to do it in Unix-like systems.

[ NOTE ]: You might need to run it as a Unix System superuser (root) - depending on how the system is configured, and what permissions your Unix account is granted)

Here is how to stop/kill the existing mysql daemon, in case it is running:

 ps -ef | grep mysql - checks if mysql/mysqld is one of the running processes. pkill mysqld - kills the daemon, if it is running.

Note: if pkill (’process kill’) is not on a particular Unix system, use kill -9 ‘pid’, where ‘pid’ corresponds to processes that were found with ps -ef | grep mysql

Step 2: Run MySQL safe daemon with skipping grant tables

 mysqld_safe --skip-grant-tables &

Step 3: Login to MySQL as root with no password

 mysql -u root mysql

Step 4: Run UPDATE query to reset the root password

In MySQL command line prompt issue the following two commands:

 UPDATE user SET password=PASSWORD("ualue=42") WHERE user="root"; FLUSH PRIVILEGES;

“ualue=42” is a common password for “The Hitchhiker’s Guide to the Galaxy” people which reads “Ultimate Answer to Life, the Universe, and Everything=42“

Step 5: Stop MySQL safe daemon

Follow the first two steps, but this time kill (pkill) “mysqld_safe” instead of “mysqld”

Step 6: Start MySQL daemon

Depending on the operating system (Unix-like examples):

 /etc/rc.d/rc.mysql start

OR

 /etc/init.d/mysql start

OR

 /etc/rc.5/mysql start

etc.. check existing MySQL configuration

Step 7: Root password is reset and ready to use

Password is reset. Privileges are flushed. Start MySQL and login as root with the password set in step 4:

 mysql -u root -p mysql

Note: sometimes (most of the time) ‘root user’ privileges are required for the system (OS) in order to stop/start processes

这里是原文链接

bitsCN.com

文档

[转载]MySQL:ResetLostRootPassword_MySQL

[转载]MySQL:ResetLostRootPassword_MySQL:bitsCN.com Here is a quick Step-by-Step “how to” which helps restoring MySQL root password that was lost/forgotten.It happens to everybody, especially if several distributed (different) systems are maintained, where the password
推荐度:
标签: 密码 root password
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top