If mysql -u root -p is rejected on a Linux server, the root account may still have full privileges. Ubuntu installations commonly configure root@localhost with the auth_socket plugin, which authenticates the operating-system root user through the local Unix socket instead of accepting a MySQL password. Try sudo mysql -u root first. If that opens a MySQL prompt, no password recovery is required.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
When socket authentication is unavailable and the password is genuinely forgotten, recover access during a controlled maintenance window: stop MySQL, start a temporary local-only instance with --skip-grant-tables --skip-networking, run FLUSH PRIVILEGES, change the exact root account row with ALTER USER, and restart MySQL normally. The emergency mode must not remain enabled.
As an Amazon Associate I earn from qualifying purchases.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsStart by identifying which access path failed
Do not begin by editing grant tables or deleting account rows. First record the exact command, error message, MySQL or MariaDB version, Linux distribution, and whether the client is connecting through the Unix socket or TCP. Those details determine which account row is being tested and whether the failure is a password problem, a host-matching problem, or an authentication-plugin mismatch.
Distinguish socket and TCP connections
A command such as mysql -u root normally prefers the local Unix socket. A command that specifies -h 127.0.0.1 uses TCP and can match a different account row. The server treats 'root'@'localhost', 'root'@'127.0.0.1', and other host-qualified identities as separate accounts. A password or plugin change applied to one row does not automatically change another.
#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.
Read the error literally
- An “access denied” error with a password supplied indicates that the tested account rejected those credentials or uses a different authentication method.
- A successful
sudo mysql -u rootsession alongside a failed password login strongly suggests local socket authentication rather than missing privileges. - A connection that works on the server but fails from another machine may be selecting a different host-qualified account, or the server may not be listening for remote connections.
Choose the recovery route
| Situation | First action | Maintenance restart |
|---|---|---|
| Local Unix-root access works | Run sudo mysql -u root, inspect the account plugin, and decide whether a password is actually needed. |
No |
| The current MySQL password is known | Log in with the working method and use ALTER USER on the exact User and Host row. |
No |
| The password is forgotten and socket login does not work | Use a local console and a temporary --skip-grant-tables --skip-networking startup. |
Yes |
| A connector requires a legacy authentication plugin | Keep the modern plugin unless compatibility is proven necessary; select mysql_native_password explicitly only for that connector. |
Usually no |
Before changing anything, confirm that a restart is acceptable and that you have console or out-of-band access. A recovery instance started without grant tables bypasses normal password checks, so it must remain isolated and short-lived.
Use Ubuntu’s socket-authentication path when it is available
Ubuntu documentation describes an initial local administrative account as 'root'@'localhost'. On many Ubuntu installations, that row uses auth_socket; MySQL authenticates the Unix root user through the local socket, so no MySQL password is required.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated 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 match- Open a root shell or invoke the client through
sudo:
sudo mysql -u root
- Wait for the
mysql>prompt. If it appears, you have administrative access even thoughmysql -u root -pfails. - Inspect the account rows before deciding whether to migrate authentication:
SELECT User, Host, plugin FROM mysql.user WHERE User = 'root';
SHOW GRANTS FOR 'root'@'localhost';
The query may show more than one root row. The Host value tells you which row is local-socket access and which rows are intended for other connection paths. SHOW GRANTS confirms the privileges actually attached to the local row; a password failure is not evidence that those privileges disappeared.
When socket authentication is the right result
Keeping auth_socket is often sensible for a server administered directly through a protected Unix account. It prevents a MySQL password from becoming the sole protection for local root access and avoids storing another reusable secret in scripts. In that arrangement, use sudo mysql -u root for local administration and create separate, limited MySQL accounts for applications and routine operators.
When you need password authentication
You may need a password when administration must occur through a tool that cannot invoke sudo, when an automation system requires a MySQL credential, or when a connector cannot use socket authentication. Do not assume that running mysql_secure_installation changes the account plugin. That utility is a hardening tool; inspect the plugin and perform an intentional account change with ALTER USER.
Change a known password with ALTER USER
Once you have a working administrative session, use the supported account-management statement rather than modifying mysql.user directly. Direct edits are version-sensitive and can damage the data dictionary.
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
Set a password on the local root row
ALTER USER 'root'@'localhost'
IDENTIFIED BY 'A-long-unique-secret';
Replace the example with a unique secret managed according to your organization’s policy. The account and host must match the row shown by your earlier query. If the client later connects through TCP, changing only 'root'@'localhost' will not alter a separate 'root'@'127.0.0.1' row.
Choose the authentication plugin deliberately
caching_sha2_password is MySQL’s modern password-authentication choice. It should remain the default when your clients support it. If a legacy connector cannot negotiate that plugin, select the compatibility plugin explicitly:
ALTER USER 'root'@'localhost'
IDENTIFIED WITH mysql_native_password BY 'A-long-unique-secret';
Using mysql_native_password solely because it is familiar weakens the reason to use the modern default and can create avoidable compatibility debt. First verify the connector limitation, then document why the older plugin is required and plan a client upgrade.
Change another host-qualified row only when it is really needed
After inspecting the account table, target the row that the failing command uses. For example, a TCP command aimed at 127.0.0.1 may require a change to 'root'@'127.0.0.1', not the local-socket row. Do not create broad wildcard root accounts merely to make a connection succeed; that expands the attack surface and hides the original host-selection issue.
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 →Recover a forgotten password with a controlled emergency startup
Use this procedure only when no working administrative login remains. It requires a maintenance window, local console access, and enough control to ensure that untrusted users cannot reach the temporary server. MySQL’s --skip-grant-tables mode permits passwordless connections with full privileges and disables account-management statements until privileges are reloaded. That combination is intentionally dangerous.
Prepare the maintenance window
- Tell users and application owners that the database will be stopped and restarted.
- Use the server’s local console or another trusted channel. Do not expose the recovery process to a production network.
- Confirm the service name and data directory used by the distribution. The examples below use a service named
mysql. - Have the exact target account in mind, normally
'root'@'localhost', but verify it once access is restored.
Stop the normal service
sudo systemctl stop mysql
Check that the normal daemon has actually stopped before starting the temporary process. Running two servers against the same data directory can corrupt data or cause confusing socket and port failures.
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)
Start a local-only recovery instance
sudo mysqld_safe --skip-grant-tables --skip-networking --user=mysql &
--skip-grant-tables bypasses password checks. --skip-networking prevents TCP clients from reaching the temporary server, leaving the Unix socket as the intended access path. --user=mysql keeps the daemon operating as the database service account rather than Unix root. Starting the server as Unix root without dropping privileges can create root-owned files in the data directory and prevent a later normal start.
Some distributions do not provide mysqld_safe, use a different service name, or package a different maintenance-start mechanism. Follow that distribution’s documented method while preserving the same safety properties: grant tables bypassed only temporarily, networking disabled, the correct database operating-system user, and a process lifetime limited to the password change.
Connect without a password
mysql -u root
If the client selects an unexpected socket, specify the socket path used by your installation. Do not add a remote host or open a firewall port; the objective is a local recovery session.
Reload grants before changing the account
In this mode, account-management statements such as ALTER USER and SET PASSWORD are disabled until the privilege tables are loaded. At the SQL prompt, run:
FLUSH PRIVILEGES;
Only after that statement succeeds should you set the password:
ALTER USER 'root'@'localhost'
IDENTIFIED BY 'A-long-unique-secret';
If the account query from a normal session previously showed a different host part, use that exact pair instead. Do not guess based on the command you intend to run later.
Free tools Windows power users keep installed
One-click scans. No signup required.
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
Exit and terminate the emergency process
EXIT;
Stop the temporary daemon using the method appropriate to your distribution. If the recovery process is still running, the normal service cannot safely take over the data directory. Once it has stopped, start MySQL normally:
sudo systemctl stop mysql
sudo systemctl start mysql
The first command is a safeguard in case a wrapper left a process behind; verify the process state between commands. Do not leave --skip-grant-tables or --skip-networking in a service override, configuration file, or startup script.
Verify access after the normal restart
Verification should test both the credential and the account identity, not merely whether a prompt appears.
- Test the intended password path:
mysql -u root -p
- At the SQL prompt, inspect the effective identities:
SELECT CURRENT_USER(), USER();
SHOW GRANTS;
USER() shows the client-supplied identity and connection host, while CURRENT_USER() shows the account row MySQL actually used for privilege evaluation. Comparing them exposes host-matching surprises. SHOW GRANTS confirms that the restored account has the privileges you intended.
- Check the account table if the result is unexpected:
SELECT User, Host, plugin FROM mysql.user WHERE User = 'root';
- Inspect service definitions and configuration overrides for any remaining
skip-grant-tablesor unintendedskip-networkingsetting. - Test only the connection path the application or administrator actually needs. A successful local login does not prove that remote access should be enabled.
Understand host-qualified root accounts
MySQL account names consist of a user part and a host part. These are distinct rows:
'root'@'localhost'commonly matches local Unix-socket access.'root'@'127.0.0.1'can match a TCP connection explicitly directed to the loopback address.- Other host names or addresses match their own rows according to MySQL’s account-selection rules.
Use the account query and the CURRENT_USER() check to identify the row in use. A password assigned to one root row does not propagate to the others. If an application needs database access, create an account for that application’s host and grant only the required database privileges instead of making a root row broadly reachable.
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.
Common traps and their fixes
“I ran mysql_secure_installation, but password login still fails”
The utility does not guarantee a migration from auth_socket to password authentication. Log in through the working method, inspect plugin, and use ALTER USER if a deliberate switch is required.
“I edited mysql.user and now the server behaves strangely”
System tables and the data dictionary differ across MySQL versions. Manual updates can leave metadata inconsistent or fail to change the authentication state. Restore from a known-good backup if necessary, then use the supported account statements after grants are available.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
“The temporary server will not start”
- Confirm that the normal service is stopped and no old daemon still owns the socket or data directory.
- Check the error log for an incorrect data directory, permissions, or an already-used socket.
- Ensure the daemon runs as the database service account, not Unix root.
- Use the distribution’s documented equivalent if
mysqld_safeis not installed.
“ALTER USER is rejected during recovery”
Run FLUSH PRIVILEGES first. In --skip-grant-tables mode, account-management statements are intentionally disabled until the privilege tables are reloaded.
“The password works locally but not from the application”
Compare the application’s host and protocol with the account row. A local socket login may use 'root'@'localhost', while the application uses TCP and selects another host-qualified row. Verify with SELECT CURRENT_USER(), USER(); and correct the exact account rather than adding a wildcard root account.
“The next restart fails after recovery”
Look for files created with the wrong owner and for persistent emergency options. A daemon started as Unix root can leave root-owned data-directory files; a service override containing skip-grant-tables can also prevent normal operation or leave the server exposed.
Use root only for administration
Restoring root access is the immediate objective, not a reason to use root for every task. Once access is verified, create separate administrative and application accounts with explicit grants. Ubuntu’s privilege model is intentionally grant-based: permissions are assigned with GRANT to the account that needs them.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →For routine work, use an account limited to the required databases and operations. Keep root access for recovery and server-level changes, protect the credential or socket path accordingly, and record which host-qualified account each automation job uses. This makes a future “root login failed” event easier to diagnose and reduces the impact of a compromised application credential.
Quick Recap
A concise recovery checklist
- Capture the exact command, error, version, distribution, and socket-versus-TCP path.
- Try
sudo mysql -u rooton Ubuntu before attempting a reset. - Query
User,Host, andplugin; confirm grants withSHOW GRANTS. - For a known password, use
ALTER USERon the exact account row. - Prefer
caching_sha2_password; choosemysql_native_passwordonly for a documented legacy-client requirement. - For a forgotten password, use a local, isolated
--skip-grant-tables --skip-networkingstartup, runFLUSH PRIVILEGES, change the account, and restart normally. - Never run the temporary daemon as Unix root or leave emergency options configured.
- Verify with
SELECT CURRENT_USER(), USER();,SHOW GRANTS;, and an actual login through the required path. - Create least-privilege accounts for applications and routine administration.
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.




