Trying to reset forgotten MySql Root Password - mysql

I installed mysql, then promptly forgot the password.
I followed the tutorial on the mysql website.
When I enter
C:> C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld --init->file=C:\users\brian\mydocuments\mysql-init.txt
in cmd, I get the message:
A required privilege is not held by the client
I tried different ways of entering the prompt, and I also considered that perhaps this is because I don't have the right administrator privileges in windows, but when I changed the settings, I received the same message in cmd. I am confused. What did I do wrong? Everything? Thank you.
GFB

You have to run the command prompt as administrator.

Related

Is MySQL root password too complex on installation on windows?

Upon installing MySQL from Oracle on my Windows machine I was prompted to enter a root password for the MySQL server. I set the following password:
eL;(4QWe-nIhq'A%t#cpJN{7PaVwvcTcsdGAYx8K
Now when I try to change settings on this server the installer asks me for my root password. When I try to type this I get the following error:
Unhandled Exception has occured in your application. If you click
Continue, the application will ignore this error an attempt to
continue. If you click Quit, the application will close immediately.
Keyword not supported.
Parameter Name: (4QWe-nIhq'A%t#cpJN{7PaVwvcTcsdGAYx8K; protocol.
Is the solution just to work with a simpler password?
I solved this problem by reinstalling the server. Another method to resetting the password is as follows:
documenation
Log on to your system as Administrator.
Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list and stop it.
If your server is not running as a service, you may need to use the Task Manager to force it to stop.
Create a text file containing the password-assignment statement on a single line. Replace the password with the password that you want to use.
MySQL 5.7.6 and later:
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
MySQL 5.7.5 and earlier:
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass');
Save the file. The example assumes that you name the file C:\mysql-init.txt.
Open a console window to get to the command prompt: From the Start menu, select Run, then enter cmd as the command to be run.
Start the MySQL server with the special --init-file option (notice that the backslash in the option value is doubled):
C:\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
C:\> mysqld --init-file=C:\\mysql-init.txt

MySQLInstallerConsole not setting root password?

I am installing MySQL on Windows with the following command line:
MySQLInstallerConsole community install -silent server;5.7.12;x64:*:type=config;servertype=Server;openfirewall=true;generallog=true;serverid=3306;enable_tcpip=true;port=3306;rootpasswd=%1;installdir="C:\MySQL\MySQLServer-5.7":type=user;username=foo;password=bar;role=DBManager
This line is contained in a script, and I pass in the root password from a random generated string. However, I am getting an access denied for 'root'#'localhost' when trying to access the server via
mysql -u root -p
(and providing the password)
I can not find any issues with the parameters for MySQLInstallerConsole. Connecting as user foo even works, but I really need the root password to work.
Any ideas?
I finally figured out what the issue was: the system had a MySQL server installed before. The service and binaries had all been removed, but there still was a MySQL data directory in the default location (somewhere in %ProgramData%"). This seems to cause to make the installer console fail to finish the new installation WITH a different root password.
Removing the old data directory and re-running the installer command line as stated in the original question (without any changes) resulted in successful installation.

MySQL Keeps Forgetting Root Password Used to Install

I'm using the MySQL Installer on Windows 8.1. I go through the installation steps for MySQL Server, including setting my password. However, when I go back to reconfigure my server through the Installer or attempt to login to the server through MySQL Command Line Client, it tells me I have the wrong password.
I have installed and reinstalled multiple times to no avail. My password has just letters (uppercase and lowercase) and spaces.
Thanks in advance.
The MySQL Docs provide instructions on how to change your root password:
http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

Recovering root password in MySQL (XAMPP)

I have an XAMPP MySQL installation and want to recover the root password. I am aware that questions have asked this already, however they are Linux methods of doing it (I'm on Windows) and I can't seem to figure out what exactly the Linux commands translate to in XAMPP - I tried looking for a place to configure the arguments to not use network etc but couldn't.
Any help would be appreciated
Recovering the exact current password is apparently not possible. This solution is for resetting a lost password on a Windows machine.
I have tested this code for 5.7[.22] (while upgrading to 8.0). Please verify your installed version and paths accordingly. (x86 machines will have slightly modified values)
-
Stop MySQL server from the services, if it is running.
Create a file mysql-init.txt in D:\ drive and put the following line in it:
ALTER USER 'root'#'localhost' IDENTIFIED BY 'NewRootPassWillComeHere';
Open command prompt and execute the following commands:
C:\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
C:\> mysqld --defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 5.7\\my.ini" --init-file=D:\\mysql-init.txt --console
The option --console will give the output in the command prompt.
Password has been reset successfully and the file mysql-init.txt can be deleted.
-
Source and other scenarios: How to Reset the Root Password

WebMatrix error "The specified password for user account 'root' is not valid...."

When creating a new Joomla, Drupal or any website involving a database from the 'App Gallery', I get the errors:
MySQL
"The specified password for user account 'root' is not valid, or failed to connect to the database server"
SQL Server
"The specified password for user account 'sa' is not valid, or failed to connect to the database server"
What can be done to stop this error occurring? I don't believe it's with the databases, I blame WebMatrix because it's the same problem for both DBs.
Thanks in advance
I had the same problem and i performed the below steps to resolve the issue:
Open Sql Server Management Studio as Administartor
Login to .\SQLEXPRESS using Windows Authentication
Go to Security Tab -- > Logins --> Change the "sa" password and Press Ok
Use the newly created Password in WebMatrix and you should be all Set.
In the case of SQL Server, I think the default database is the .\SQLExpress when you using WebMatrix to install Joomla, so the "sa" is the user of .\SQLExpress. You should check the password for that.
I followed the directions here:http://www.microsoft.com/web/post/understanding-mysql-errors-when-installing-web-apps-in-webmatrix and it fixed this issue.
You need to not only uninstall MySQL, put also delete the folder \ProgramData\MySQL
as the password details are cached there.
For MySQL problem: Follow these steps to reset the root password.
Stop the MySQL server if it is running.
Create a text file containing the new password and save to a place. The content is: ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
Start the MySQL Client Command Line by using cmd, then input
C:> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
C:> mysqld --init-file=C:\mysql-init.txt
After the server has started successfully, delete the text file.
Now you can use the new password that you provided above to continue the installation of Web Platform Installer.
References: http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html.