Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1884
  • Last Modified:

MySQL root pw reset

Hi,

My colleague set up a MySQL db instance on our web server many years ago and we want to expand the number of dbs, but we can't remember the root password.

So I found this document to reset a local MySQL root user password:

http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

And tried to follow it's instructions but I cannot seem to get the command line to work. My directory structure for MySQL is different than the document states and I think that is part of the problem. Basically it doesn't seem to recognize that I'm changing directory locations and instead takes my new location as an unrecognized command. Is my syntax wrong?

My directory structure is:

C:\Program Files\MySQL\MySQL Server 5.1\bin

and below is a sample of the problems I'm having at the command line:

Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.


C:\Program Files>MySQL\MySQL Server 5.1\bin\mysqld-nt --init-file=C:\\Program Fi
les\MySQL\mysql-init.txt
'MySQL\MySQL' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files>cd MySQL

C:\Program Files\MySQL>MySQL Server 5.1\bin\mysqld-nt --init-file=C:\\Program Fi
les\MySQL\mysql-init.txt
'MySQL' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\MySQL>cd MySQL Server 5.1

C:\Program Files\MySQL\MySQL Server 5.1>bin\mysqld-nt --init-file=C:\\Program Fi
les\MySQL\mysql-init.txt
'bin\mysqld-nt' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\MySQL\MySQL Server 5.1>cd bin

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqld-nt --init-file=C:\\Program Fi
les\MySQL\mysql-init.txt
'mysqld-nt' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\MySQL\MySQL Server 5.1\bin>cd..

C:\Program Files\MySQL\MySQL Server 5.1>cd..

C:\Program Files\MySQL>cd..

C:\Program Files>cd..

C:\>C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld-nt --init-file=C:\\Progra
m Files\MySQL\mysql-init.txt
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Does anyione see anything obvious that I'm doing wrong here?

Thank you

Bill
0
billium99
Asked:
billium99
  • 5
  • 4
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
use "mysql-nt" instead ... the "-" is the issue, you have to quote it ...
also "program files" with the space would require the escaping

for example:
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld-nt" --init-file="C:\Progra
m Files\MySQL\mysql-init.txt"

Open in new window

0
 
billium99Author Commented:
Thanks I'll try that this evening (have to take down live sites for this...)

Bill
0
 
billium99Author Commented:
No it still didn't work - a bunch of different variations:


C:\Program Files\MySQL\MySQL Server 5.1\bin>"mysqld-nt" --init-file="C:\Program
Files\MySQL\mysql-init.txt"
'"mysqld-nt"' is not recognized as an internal or external command,
operable program or batch file.


C:\Program Files\MySQL\MySQL Server 5.1\bin>cd..

C:\Program Files\MySQL\MySQL Server 5.1>cd..

C:\Program Files\MySQL>cd..

C:\Program Files>cd..

C:\>"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld-nt" --init-file="C:\Prog
ram Files\MySQL\mysql-init.txt"
'"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld-nt"' is not recognized as a
n internal or external command,
operable program or batch file.

Anyone have any idea on this one?

Thanks

Bill
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
C:\Program Files\MySQL\MySQL Server 5.1\bin>

please run a dir command in that folder....
0
 
billium99Author Commented:
Hmm ok that appears to be part of the problem. I don't see mysqld-nt anywhere:


 Directory of C:\Program Files\MySQL\MySQL Server 5.1\bin

08/13/2010  09:25 AM    <DIR>          .
08/13/2010  09:25 AM    <DIR>          ..
01/23/2009  03:38 AM         2,596,352 libmySQL.dll
01/23/2009  03:38 AM         2,197,120 myisamchk.exe
01/23/2009  03:38 AM         2,075,264 myisamlog.exe
01/23/2009  03:38 AM         2,109,056 myisampack.exe
01/23/2009  03:38 AM         2,058,368 myisam_ftdump.exe
01/23/2009  03:38 AM         2,626,688 mysql.exe
01/23/2009  03:38 AM         2,520,704 mysqladmin.exe
01/23/2009  03:38 AM         2,640,000 mysqlbinlog.exe
01/23/2009  03:38 AM         2,518,144 mysqlcheck.exe
01/20/2009  12:27 AM        14,717,568 mysqld-debug.exe
01/20/2009  12:27 AM         2,837,449 mysqld-debug.map
01/20/2009  12:27 AM        18,706,432 mysqld-debug.pdb
01/23/2009  03:38 AM         8,299,648 mysqld.exe
01/23/2009  03:38 AM         3,598,416 mysqld.map
01/23/2009  03:38 AM        18,452,480 mysqld.pdb
01/23/2009  03:38 AM         2,587,264 mysqldump.exe
01/23/2009  03:38 AM         2,512,512 mysqlimport.exe
11/12/2008  02:13 AM         2,972,288 MySQLInstanceConfig.exe
01/23/2009  03:38 AM         2,595,456 mysqlmanager.exe
01/23/2009  03:38 AM           725,142 mysqlmanager.map
01/23/2009  03:38 AM         5,091,328 mysqlmanager.pdb
01/23/2009  03:38 AM         2,513,024 mysqlshow.exe
01/23/2009  03:38 AM         2,696,832 mysqltest.exe
01/23/2009  03:38 AM         2,925,056 mysql_client_test.exe
01/23/2009  03:38 AM         1,875,072 mysql_upgrade.exe
01/23/2009  03:38 AM         1,794,560 my_print_defaults.exe
01/23/2009  03:38 AM         1,778,176 perror.exe
01/23/2009  03:38 AM         1,785,856 replace.exe
              28 File(s)    119,806,255 bytes
               2 Dir(s)   4,202,074,112 bytes free

C:\Program Files\MySQL\MySQL Server 5.1\bin>

Why wouldn't I have this file? This is a Windows server if that makes any difference...

Thanks for your time

Bill
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
please use the mysqld instead of mysqld-nt
0
 
billium99Author Commented:
ok different results, but it still does not appear to have granted me access. Here is what came back:


C:\Documents and Settings>cd..

C:\>"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --init-file="C:\Program
 Files\MySQL\mysql-init.txt"
111021  7:47:42 [Warning] The syntax '--log' is deprecated and will be removed i
n MySQL 7.0. Please use '--general_log'/'--general_log_file' instead.
111021  7:47:42 [Warning] The syntax '--log_slow_queries' is deprecated and will
 be removed in MySQL 7.0. Please use '--slow_query_log'/'--slow_query_log_file'
instead.

Wouldn't I get some kind of confirmation that the txt file was processed?

Also I'm using HeidiSQL and that is where my root login is failing still.

What is the command line for accessing the root of the MySQL instance?

Thanks
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you did misunderstand the page ...
the text file you need to pass there is not the mysql init file, but basically a file containing the script to update the root's user password:

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;

Open in new window


the error messages you got indicate that you did not specify such a file, but the normal init file.
0
 
billium99Author Commented:
But my init file reads precisely as the text in your last post. I get it. The txt file had a command to reset the password. The CMD command pointed to this txt file to run.

Everything appears to be in place. Does the txt file need to be in the bin directory?

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now