Need to reset the database username or create a new database

I accessed the database through AdminNeo in Local, unfortunately, I accidentally delete my user name “root”, and now I cannot access my local site or the database at all because the default is root, of course. I am hoping I do not need to create a new site. I hoped I would be able to copy the site through Local App but it copied the database too and the issue persisted. I have looked for ways to fix this but most solutions require me to log into the database first which is no longer possible. I have tried skip-grant-tables in my.cnf.hbs and resetting the username through the cmd line

Hi @Learn!

If you click on Site Shell (in the Local app, the button is under your site name towards the top), does that open for you okay?

If that opens, can you try running mysql -u root to connect to the database and then this?

CREATE USER ‘root’@‘localhost’ IDENTIFIED BY ‘’;
GRANT ALL PRIVILEGES ON . TO ‘root’@‘localhost’ WITH GRANT OPTION;
FLUSH PRIVILEGES;

There are other workarounds, but hopefully this does the trick without as much trouble.

Hi I can’t run mysql -u root. Every time, access is denied for ‘root’@’localhost’

I think your best bet will be the new site route. You could create a new, blank install, and then manually migrate your WP-Content and any database tables you need into the new one. The steps would be similar to our manual steps here:

Manually Import a Local Site

Once you have the new site working, I’d recommend making a fresh backup with our native Cloud Backups feature. That way if you run into trouble again, you can just quickly restore from a backup point. Local Cloud Backups - Local

Oh my goodness, thank you so much! But I have to add, on the new site, the Command Line didn’t work so I had to import the local.sql file in Admin Neo instead. It gave me access to the front facing end of my site but I still had issues connecting to the admin php until I searched and replaced on the command line. EXCEPT now I cannot access the admin of my site with the username and password I chose for the new site and I had to use my old username and password combination.

Thank you so much!

Glad to hear you got things working again @Learn!

If you ever need to edit or create new admin credentials manually we have some steps on how to do that here as well: Reset a WordPress admin password - Local