在其他机器上安装一个同版本的mysql,把data中mysql的用户表文件覆盖过去

解决方案 »

  1.   

    There are two ways to solve it:1.Backup your data directory except mysql in it.Reinstall mysql and cover the new data directory;2.Rename the mysql directory in the data directory as "mysqlold", then copy it to another mysql/data directory, which you know the password of "root" ( keep the same version of the two mysql ) then copy the passworld string in database "mysql", table "user", username "root" and cover the password string in database "mysqlold", table "user", username "root"(if you do not change root's name). Then copy back the "mysqlold" directory to the mysql/data you lost the password and rename back to "mysql", login using the password of the other mysql.
      

  2.   

    运行mysql\bin\winmysqladmin.exe
    你就会知道密码是什么!
      

  3.   

    我是新手,进来看看在MYSQL里可以找到my.ini这个文件,里边找到
    # This will be passed to all mysql clients
    [client]
    #password=my_password
    直接找到mysql clients(我的机子是装PHP),找到配置文件(我的机子是config.inc.php),里边可以很容易找到数据库名和密码一项!
      

  4.   

    linux 解决方法如下:
    1、杀死mysql进程,kill -TERM pid,如果不行,强行终止,但不提倡 kill -9 pid
    2、启动mysql 加参数“--skip-grant-tables”,不加载权限表。mysqld --user=mysql --skip-grant-tables &
    3、mysql -u root -p 直接回车就可进入。
    4、修改root密码,最后别忘了flush privilegeswindows:
    1、在服务里停掉mysql ,net stop mysql
    2、在命令提示符下进入mysql\bin,
    3、输入:mysqld-nt --skip_grant_tables,启动mysql。
    4、重开一个cmd窗口。用myql -u root -p 直接回车进入。修改root 密码。