Forgotten MySQL root password - mysql

I'm kind of stuck on what to do with this. There were several options I found between this site and the mysql site on how to resolve a forgotten root password, but I think I've now broken it.
I was unable to use the line command with the created reset text file that mysql.com recommended here
So I uninstalled WAMP which is what I had used to install it to begin with. That also failed because after reinstall I had a new version and I couldnt log into either of them. Apparently both versions were still there as uninstalling WAMP didnt uninstall MySQL.
So I tried the make-sure-everything-is-deleted steps here and rebooted and reinstalled WAMP. No go, won't take default password.
Tried to run the command line command using the newest version and got this error.
Now I can't do anything I need to get done and all other posts I find on this seem to be variants of these things I've already tried.

This time around, the newer version of mysql let me log in with no password. I was able to get it fixed from the command line and get it reset to what I wanted. Tried that multiple times before, so I cannot say I understand what changed now, but it did.

Try to reset you password as described here
stop the mysql service (likely requires user to be admin/root)
write ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass'; into new file and save it under C:\mysql-init.txt (for windows)
Open cmd.exe (with admin privilges) and enter commands (see below)
Commands
C:\> cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
C:\> mysqld --init-file=C:\\mysql-init.txt
It worked for me.

Related

Cannot find mysql bin file in macos

I am having a lot of problems with mysql on macos 10.14. It started with trying to reset my password. Back when I collaborated with someone in 2018 my collaborator used mysql but I did not know how to work it. I have a feeling that the password I used for mysql is not the typical password I used because my attempts to log in failed. watching this video I was told at 9:12 that the password would be set on installation but that turned out to be false. I was never asked for a password upon downloading but perhaps that is because I had part of mysql already downloaded on my computer but I did not have the workbench installed. All of my attempts to reset the password failed. So I then tried deleting mysql and redownloading. Now I am not able not to start the mysql server from mac's system preferences. But that's not my largest problem. I still cannot reset the password and hence even use the app. Following official mysql instructions I cannot reset the password because it requires the location of a pid file. It says
Stop the MySQL server if it is running. Locate the .pid file that contains the server's process ID. The exact location and name of this file depend on your distribution, host name, and configuration. Common locations are /var/lib/mysql/, /var/run/mysqld/, and /usr/local/mysql/data/.
In the folder for mysql located in /usr/local/var/mysql there is no pid file. A lot of the tutorials I've seen recommend using terminal but I cannot use terminal for mysql because I get the mysql command not found error. Ok, so to fix that problem trying this tutorial here it says:
If you’re installing MySQL using the official installer, then your MySQL bin/ folder should be located on /usr/local/bin/mysql
So now I need to find the mysql bin file but when I write ls in the /usr/local/bin folder, mysql does not come up. All of the file beginning near 'my' are
multinit
murge
nasm
So I'm stuck. I find it simply incredible that such a simple thing as resetting a password is so difficult.
Let’s say we installed MySQL version is 8.0 on our Windows OS. The bin directory is present at the following location −
C:\Program Files\MySQL\MySQL Server 8.0\bin

Installing MySQL and checking root password fails?

I recently uninstalled and reinstalled MySQL (on Windows 7) using the installer. When I try to set up the MySQL Server, it won't let me continue unless I enter the "current" root password??? I don't understand how there can be a current root password if I completely uninstalled and reinstalled the program.
I've tried with a blank password as well as every password I can possibly think of that I would have used and nothing works. Google is completely unhelpful as every result I've found either refers to a "homebrew" installation, whatever that is, or refers to installations on Linux. Is there some folder of config files that the uninstallation refuses to delete that I need to remove manually? Or am I missing something else?
After uninstallation process, please check following directories if it exists and remove:
C:\Program Files\MySQL
C:\Program Files (x86)\MySQL
C:\ProgramData\MySQL
C:\Users[User-Name]\AppData\Roaming\MySQL
PS: Please keep in mind that If you have multiple MySql Instances installed on your workstation, you need to go into each directory and delete only the relevant instance.
I too faced the same issue but the following worked for me:
Go to Control Panel >> Programs >> Programs and Features, select MySQL Server and click Uninstall.
Also uninstall the MySQL workbench, MySQL Installer Community, MySQL Router.
Then delete the files:
C:\Program Files\MySQL
C:\Program Files (x86)\MySQL
C:\ProgramData\MySQL
C:\Users\[User-Name]\AppData\Roaming\MySQL
Finally restart your system and install MySQL again.
In a fresh development machine, after installing MySQl 8.0.18 in Windows 10 64 bit, I hit this error and could not connect to MySql.
Nothing else worked.
Then I uninstalled the Mysql and deleted C:\Program Files\MySQL and retried installing MySql 8.0.18 and while re-installing it asked to specify root user password.
After specifying the root password, I was able to connect.
I was also facing the same problem, i tried the same process and this works for me too. Also i uninstalled my MySQL installer, MySQL shell, MySQL workbench, MySQL server and all connectors and routers from my Control Panel>>Uninstall a program and after deleting everything. I tried this solution install MySQL again from the oracle website and everything worked fine.
when I was facing the same issue, I used "password" for root password, which is default for MySql.

MySQL won't configure, incorrect root password?

So i've installed MySQL server 5.6, and it just will not let me in as it keeps telling me i've got the root password wrong on the installer.
I may or may not have used another MySQL server before, but have long since deleted it and set a new root password upon installing this new server.
Since it wasn't letting me in, i decided to see if there was another way to find out my password (which there isn't) or change it (which there is) but this hasn't worked either.
This is the document i was using.
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
I have changed my password multiple times now, it's accepted it according to the command prompt, and yet it still won't let me use SQL server...
Oh and i am on the administrator's account. How do i find out, or fix the root password permanently?
Okay i've finally figured out how to solve this (and in turn get it to install fully!).
What i did was delete everything from my system relating to MySQL, uninstall it and then re-download the installer. When installing i created a new file location and made MySQL install under C:\MySQL (a new folder i made), rather than let it install into C:\Program Files... and this seemed to make it install immediately, and meant that it couldn't find (if they were still there) any previously made root passwords.
The key to what it says in that link is to run it as administrator in the Windows sense. Otherwise it all appears to work but it reverts itself when you exit.
I just had this same issue. If you go into the installer and remove MYSQL Server and re-install, it will allow you to set the root password again and continue with your configurations.

MySQL Workbench "fetching..." -- cannot browse DB

I've been having a lot of issues lately, basically since the last time I upgraded XAMPP for OSX (v1.7.3) and/or my MySQL GUI tools. Using MySQL Workbench (v5.2.44), I can connect to the DB running in XAMPP just fine, but trying to browse any database, under tables/views/etc it only shows "Fetching..." and never shows anything else. I can actually query tables, which is interesting, but I can't actually manage the databases in any meaningful way.
Googling, others reported having luck running mysql_upgrade on the command line, which ran fine but did not fix my issue.
The following command worked for me on windows:
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql_upgrade.exe -u root -p --force
If the root password is not set, you might need to do this before you run the command above:
mysql> SET PASSWORD FOR 'root'#'localhost' = PASSWORD('something');
The link above to mysql_upgrade did not solve my problem directly, but it did lead me to examine my mysql error file, which ultimately led me to the solution. I noticed several lines like this in the error file (located at [xampp root]/var/mysql/[dbname].err):
/Applications/XAMPP/xamppfiles/sbin/mysqld: Can't create/write to file
'/var/folders/y2/37h93r_931sdfpcr7vnc83380000gn/T/ibigNFFi' (Errcode: 13)
That led me to this page in the MySQL docs which states that you should explicitly set the temp folder for MySQL. I double-checked my config file ([xampp root]/etc/my.cnf) and saw this, which looked fine:
[mysqld]
tmpdir = /Applications/XAMPP/xamppfiles/temp/
However, looking back at the error log, I also noticed this:
Warning: World-writable config file '/Applications/XAMPP/xamppfiles/etc/my.cnf' is ignored
Duh. The config file was getting ignored, so the configured temp folder was not getting used (I have no clue why the file was world-writeable...). I edited permissions on the my.cnf file which was 777 and simply removed the "Everyone|write" permission (now 775 / -rwxrwxr-x), reloaded everything, and now everything works.
Not a very intuitive symptom for the ultimate fix, so hopefully this helps someone else.
If you have MAMP instead of XAMP the solution above won't work for you.
Open MAMP then on the top menu go to Tools->Upgrade MySQL databases.
Now open Mysql Workbench and it should list all your tables correctly
If you are using linux distro the run following command:
mysql_upgrade -u root -p
I set Authenticated Users with all privileges to the var/folders/y2/
For me work fine ;)
Before the process I removed authenticated users privileges.
Close and reopen Workbench. it worked for me.
Stop server.
close workbench window
start server
open workbench window
worked for me .. windows 64bit
I had that error with MySQL 8, win10. I've noticed that this line Where the error was
Was leading to another directory trying to find the my.ini file. Looked for it, found it in that directory, changed it. Opened Workbench, clik on every item that was in gray, and turned it into black and that's it!! Ok now!!

Accessing mysql via terminal

A while back I installed xampp and could not get it to run because the ports were already being used. Someone recommended that I type .. I believe it was: kill all, into the terminal to, I guess, kill the conflicting connections. This worked and I was able to access phpMyAdmin, but then I started having the problem again so i switched to MAMP. Now I can not access MySQL through the terminal. This is what I type in and this is what I get:
Macintosh:~ scottmcpherson$ mysql -u root --password=This_is_where_I_typed_my_pw
-bash: mysql: command not found
Macintosh:~ scottmcpherson$
I can, however access my database through phpMyAdmin. But the tutorials I'm following only show you how to create a database through the terminal plus I would really like to learn how to do it both ways. So, I'm thinking that the killall command screwed something up, or the other command that someone recommended a while back- which I can't remember.
You need to adjust your PATH environment variable. Details are here: http://www.metaltoad.com/blog/getting-command-line-access-php-and-mysql-running-mamp-osx
In short, open (or create) a .profile file in your home directory, and add this line:
export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php5/bin/:/opt/local/bin:/opt/local/sbin:$PATH
Paths may need to be adjusted depending on the location of your MAMP install.