首页 > 编程知识 正文

centos root密码忘记了,linux的mysql默认密码

时间:2023-05-05 13:47:00 阅读:138433 作者:4780

有一台机器的MYSQL服务器很久没有使用了,忘记了超级用户密码,无法连接。 情急之下,在网上寻找方法,解决,记录在此。

例如,对于Linux Mint 14,请更改MySQL的登录设置。 Linux配置文件的位置因版本而异

alpha @ Acer/etc $ sudo pluma/etc/MySQL/my.cn f//pluma编辑器,相当于vi

在[mysqld]段落中添加“skip-grant-tables”

例如:

[mysqld]

skip-grant-tables

datadir=/var/lib/mysql

socket=/var/lib/MySQL/MySQL.sock

保存并退出。

重新启动mysqld

登录并更改MySQL的根密码

alpha @ Acer/etc $/usr/wq ddw/MySQL

welcometothemysqlmonitor.command send with; 或 g。

Your MySQL connection id is 219

服务器版本:5.5.34-0 Ubuntu0. 12.10.1 (Ubuntu ) )。

版权所有(c ) 2000,2013,Oracle and/oritsaffiliates.all rights reserved。

oracleisaregisteredtrademarkoforaclecorporationand/or its

affiliates.othernamesmaybetrademarksoftheirrespective

办公。

类型帮助;' or 'h ' forhelp.type 'coclearthecurrentinputstatement。

mysql

mysql USE mysql;

readingtableinformationforcompletionoftableandcolumnames

youcanturnoffthisfeaturetogetaquickerstartupwith-a

数据库已更改

mysqlupdateusersetpassword=password (' new-password ' ) WHERE User='root ';

Query OK,0Rowsaffected(0.00sec ) )。

rows matched :2 changed : warnings :

mysql flush privileges;

Query OK,0Rowsaffected(0.01sec ) )。

mysql quit

Bye

完成了。 在phpMyAdmin上连接测试成功。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。