If MySQL rejects root, first prove which account you are actually testing: 'root'@'localhost', a different host entry, socket versus TCP, and the password source used by the client. Retry with mysql --no-defaults -u root -p to exclude a stale option-file password. If the password is genuinely lost, reset it through MySQL’s temporary recovery procedure, then restart normally and verify a fresh login.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
The common message is ERROR 1045 (28000): Access denied for user 'root'@'localhost'. The fix depends on whether the password is wrong, no password was sent, the host part selected another account row, or the server is running in an unusual authentication or recovery state.
As an Amazon Associate I earn from qualifying purchases.
What MySQL error 1045 actually tells you
MySQL identifies an account by both user and host. The account 'root'@'localhost' is not automatically the same as 'root'@'127.0.0.1', 'root'@'server-name', or 'root'@'remote-client'. A connection that changes from a Unix socket to TCP, or from a local hostname to an IP address, can therefore match a different row and use a different password or authentication plugin.
Interpret the password indicator
using password: YESnormally means the client supplied a password and MySQL rejected it. The value may be mistyped, expired, assigned to another host-specific account, or replaced by an option file.using password: NOmeans no password was sent. You may have omitted-p, connected with an empty-password assumption, or used a client configuration that did not provide credentials.
Copy the complete error before changing the account. The host shown after the user name is the account identity MySQL tried to authenticate, not merely a description of your computer.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Exclude client option files first
MySQL clients can read option files that silently add a user, host, port, socket, or password. A stale entry can make a correct password appear to fail. Put --no-defaults before the other client options:
mysql --no-defaults -u root -p
The client will prompt for the password without reading its usual option files. If this succeeds, inspect the option files used by your installation and remove or correct the obsolete credential rather than changing the server account unnecessarily.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Safe diagnostic sequence
- Capture the whole error. Record whether it says
using password: YESorNO, and note the host displayed in the account name. - Test the intended local account without defaults. Run
mysql --no-defaults -u root -pon the database host. This tests the local socket or the client’s normal local behavior without an option-file password. - Make TCP details explicit when appropriate. For a network connection, use the exact endpoint, for example
mysql --no-defaults -h db.example -P 3306 -u root -p. The hostname and port can select a different account row than a socket connection. - Use a working administrative account if one exists. Do not reset
rootblindly. Inspect the account rows and their authentication plugins first. - Check service state and the server error log. A startup failure, wrong data directory, permissions problem, or server listening on another port can look like a password problem when the client is reaching a different instance or no instance at all.
- Only then choose a reset method. Use the least disruptive route that matches your operating system, access level, and whether the password is known.
Check the exact account row before changing anything
If another administrator can connect, identify every root row rather than assuming the local row is the one that failed:
SELECT User, Host, plugin FROM mysql.user WHERE User = 'root';
Compare the Host values with the endpoint in your failing command. A row for localhost may have a different password and plugin from a row for 127.0.0.1 or a server name. Change only the row that corresponds to the connection you intend to repair. If no matching row exists, changing a different root row will not fix the rejected connection.
Use the administrative connection itself as evidence: record whether it uses a socket or TCP, the hostname and port, and the account identity shown by the error. Keep those details consistent when you retest. This avoids the common cycle of changing 'root'@'localhost' while the application is actually authenticating as 'root'@'remote-client'.
Choose the appropriate recovery path
| Situation | Best next step | Downtime and exposure | Important qualification |
|---|---|---|---|
| Password probably known; no other administrator | Retry with --no-defaults, then verify host, socket, port, and account identity. |
None | Do not alter the account until you have ruled out a client-side password or host mismatch. |
| Another administrative account works | Query mysql.user, identify the exact root host row, and run ALTER USER for that row. |
Usually none | The administrative account must have the privileges required for account management. |
| Password forgotten on Unix-like systems | Stop MySQL, start a local temporary server with --skip-grant-tables (and normally --skip-networking), run FLUSH PRIVILEGES, then ALTER USER. |
Required downtime; passwordless, all-privilege exposure while the temporary server runs | Keep the server local and the recovery interval as short as possible. |
| Password forgotten on Windows | Use a one-line --init-file containing ALTER USER, then remove the file and restart the service normally. |
Required service restart; the file contains the new password | The service’s existing --defaults-file may be required. |
Fresh server initialized with --initialize-insecure |
Log in locally without a password and assign one immediately with ALTER USER. |
None if first access is available | An account without a password is insecure and must not be left that way. |
Known-password cases should be handled without downtime whenever possible. A working administrator is the safest route because it preserves normal authentication and does not expose an unrestricted server. The Unix recovery route is a last resort when no usable administrator remains, while the Windows init-file method places the new secret in a temporary file that must be protected and deleted.
Reset a forgotten password on Unix-like systems
This procedure is for an account you are authorized to administer. It temporarily bypasses normal grant-table authentication. MySQL warns that this mode lets anyone connect without a password and with all privileges, while account-management statements such as ALTER USER are initially unavailable until privileges are reloaded.
1. Stop the normal server
Use the service manager appropriate to your installation, such as the distribution’s MySQL service unit. Confirm that the normal process has stopped before starting a second instance; two servers using the same data directory can corrupt data or fail unpredictably.
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
2. Start a local recovery instance
Start mysqld with --skip-grant-tables. Add --skip-networking so TCP clients cannot reach the unrestricted instance. Use the same data directory, socket, and configuration that the service normally uses, but do not start it as an uncontrolled Unix root process.
mysqld --skip-grant-tables --skip-networking
Exact startup syntax varies by package and data-directory layout. The server should run as its normal service account, commonly mysql. If an administrator must launch the process as Unix root, include --user=mysql so MySQL does not create root-owned data or log files that later block normal startup.
3. Connect locally without a password
From the same machine, connect through the local socket:
mysql
If the client chooses a different socket or port, specify the socket used by the temporary server. Do not expose this instance to a network while grants are disabled.
4. Reload the account tables
Run this statement before attempting to change the password:
FLUSH PRIVILEGES;
Reloading privileges re-enables the account-management statements needed for the reset.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems5. Set the password for the exact account row
For the usual local root account, use the current account-management syntax:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
Replace the host part if your installation has a different root row. A password changed for 'root'@'localhost' does not change a separate 'root'@'127.0.0.1' or remote-host account.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
6. Shut down recovery mode and restart normally
Exit the client, stop the temporary server cleanly, and start the regular MySQL service without --skip-grant-tables and without any temporary --skip-networking setting. Do not leave the recovery process running in the background.
7. Verify a clean login
mysql --no-defaults -u root -p
Enter the new password at the prompt. If the login works locally but the application still fails, compare the application’s host, port, socket, user, and password with the values used in this manual test.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Reset the password on Windows with an init file
MySQL documents an alternative that avoids leaving the server in grant-table bypass mode. It uses a temporary file containing one SQL statement that the server executes during startup.
- Stop the MySQL Windows service.
- Create a text file, for example
C:mysql-init.txt, with exactly one line:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
- Find the service’s Path to executable in the Windows service manager. It shows the installation and, when applicable, the required
--defaults-fileoption. - Start
mysqldmanually with the init file and the installation’s normal defaults file, for example:
mysqld --defaults-file=C:pathtomy.ini --init-file=C:mysql-init.txt
Use the actual paths from your service configuration; do not copy the example path literally. Wait for the server to execute the statement successfully, then stop that manually started process.
- Delete
C:mysql-init.txt. The file contains the new password and must not remain readable. - Start the MySQL service normally and test the account with the intended host and port.
If the service fails to start, inspect its error log and confirm that the defaults file, data directory, and service account match the original installation.
Repair root while another administrator can log in
A working administrative account is safer than a grant-table bypass. Connect with that account and inspect the root rows:
Recommended Free Tools
SELECT User, Host, plugin FROM mysql.user WHERE User = 'root';
Identify the row corresponding to the connection you want to repair. Then run ALTER USER against that exact User and Host combination, for example:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
If the statement is rejected, the connected administrator lacks the account-management privilege required for the operation. Do not work around that error by editing password columns directly; use an account with suitable privileges or follow the documented recovery path for your server version.
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Authentication-plugin and version considerations
Use ALTER USER on current MySQL releases. Older guides that directly update password columns are version-specific and can leave an account unusable, especially when the server stores authentication data differently.
Do not force a plugin merely because a tutorial names it. Plugin availability, defaults, and required privileges vary by release. MySQL records that mysql_native_password is deprecated as of MySQL 8.0.34. A plugin-specific form such as IDENTIFIED WITH ... should be used only when the target server supports it and the administrator has the required account-management privileges. If you do not have a compatibility requirement, let the installed MySQL version use its supported default rather than copying legacy syntax.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
When a fresh initialization created a passwordless root
A server initialized with mysqld --initialize-insecure can leave root without a password. That is different from a rejected password: the correct first connection may be a local login that supplies no password, followed immediately by an account change:
mysql --no-defaults -u root
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
Set the password before enabling application access or allowing network connections. Never treat an empty-password root account as a permanent installation setting.
Why local and remote tests can disagree
MySQL’s account matching includes the host. A local socket test may match 'root'@'localhost', while a command using -h 127.0.0.1 or a machine name can match another row. Remote root access may be intentionally absent even though local root access works.
Make each test explicit:
mysql --no-defaults -h localhost -u root -p
mysql --no-defaults -h 127.0.0.1 -P 3306 -u root -p
Use the host and port that the application actually uses. If only the socket test succeeds, inspect the corresponding host rows rather than changing a working local password.
Free tools Windows power users keep installed
One-click scans. No signup required.
Troubleshoot a reset that still fails
The temporary server will not start
- Confirm the normal MySQL service is stopped and no other
mysqldprocess owns the data directory or port. - Read the server error log for data-directory, permission, socket, and configuration errors.
- Check ownership of the data and log files. Starting as Unix root without
--user=mysqlcan create files that the normal service account cannot open. - Use the installation’s real configuration and data directory instead of assuming a package default.
FLUSH PRIVILEGES works but ALTER USER is rejected
Make sure you are connected to the intended temporary instance and that the statement was run after FLUSH PRIVILEGES;. If a normal administrative account is available, use it instead and verify its account-management privileges. Also confirm that your SQL syntax matches the server version; do not substitute a legacy password-column update.
The new password works locally but not over TCP
Check the host-specific account row, port, bind address, and authentication plugin. Test the exact endpoint with -h and -P. A successful socket login proves only that one account identity and connection method work.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
The command succeeds but the application still reports access denied
Compare the application’s configuration with the successful command character by character: username, password, hostname, port, socket path, and selected database. Restart or reload the application after changing credentials, and ensure it is not reading a separate secret or option file.
Recovery cleanup and security checklist
- The temporary server has been stopped.
- MySQL is running normally without
--skip-grant-tables. - Any temporary
--skip-networkingsetting has been removed from the normal service configuration. - The Windows init file, if used, has been deleted.
- A fresh login with
mysql --no-defaults -u root -psucceeds against the intended host and port. - The application uses the same account identity, endpoint, and password that passed the manual test.
- No root-owned files were left in directories that the normal MySQL service account must write.
The critical safety rule is to minimize the interval in which grants are bypassed. --skip-grant-tables enables passwordless, all-privilege access, so it should be used only locally, for the shortest practical time, and followed by a normal restart and an explicit login test.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchFrequently Asked Questions
Why does MySQL say “using password: YES” when I know the password is correct?
The client may be reading an old password from an option file, or your command may be matching a different host-specific account. Retry with mysql --no-defaults -u root -p, then test the exact hostname, socket, and port used by the application.
What does “using password: NO” mean?
No password was sent to the server. Include -p to receive a prompt, unless the account was intentionally created without a password during an insecure initialization. Set a password immediately after that first local login.
Can I reset root without another administrator account?
Yes. On Unix-like systems, stop MySQL, start a local temporary instance with --skip-grant-tables and usually --skip-networking, connect locally, run FLUSH PRIVILEGES;, and then run ALTER USER. Stop the temporary process and restart normally as soon as the change is complete.
Why does a socket login work while 127.0.0.1 fails?
Those connections can select different MySQL account rows because account names include a host part. Inspect the Host values for root and reset the row matching the TCP endpoint, not just 'root'@'localhost'.
Is it safe to leave –skip-grant-tables enabled?
No. It permits passwordless connections with all privileges and disables normal account protection. Keep the server local, minimize the recovery interval, stop it, remove temporary networking settings, and verify a normal login after restarting.
What should I do if an old tutorial tells me to update mysql.user directly?
Use ALTER USER on current releases. Direct password-column edits are version-specific and can break authentication. Avoid forcing legacy plugins; mysql_native_password is deprecated as of MySQL 8.0.34.
The Bottom Line
Start with mysql --no-defaults and verify the exact User, Host, socket, and port. If the password is lost, use the documented Windows init-file method or a tightly controlled Unix recovery instance, run FLUSH PRIVILEGES before ALTER USER, then remove every temporary setting and confirm a clean normal login.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errors




