Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


StevieT

702 posts

Ultimate Geek


#310955 3-Dec-2023 11:06
Send private message

Installed LAMP as per https://phoenixnap.com/kb/how-to-install-lamp-in-ubuntu

 

Installed phpMyAdmin as per https://ubuntu.com/server/docs/how-to-install-and-configure-phpmyadmin (plus adding 'Include /etc/phpmyadmin/apache.conf' to /etc/apache2/apache2.conf)

 

Can't log in using the MySQL password set.

 

Get the following:

 

"mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)"

 

 

 

How do I go about resetting this password or otherwise fixing the issue so I can log in?


Create new topic
bigalow
566 posts

Ultimate Geek




itxtme
2102 posts

Uber Geek


  #3167812 4-Dec-2023 09:18
Send private message

Isnt the default installation root with no password over localhost?


StevieT

702 posts

Ultimate Geek


  #3168020 4-Dec-2023 15:24
Send private message

itxtme:

 

Isnt the default installation root with no password over localhost?

 

 

 

 

Tried logging in with just username root and no password, but same message. Yet to look at solutions provided on https://kinsta.com/knowledgebase/mysql-error-1045/

 

 




Firesphere
23 posts

Geek


  #3168034 4-Dec-2023 16:06
Send private message

In the instructions you linked, nowhere do I see the set-up of the root password.

 

So a few options, all from terminal:

 

     

  1. Try logging in with "sudo mysql"
  2. Scour the logs for the generated password in /var/logs/mysql*
  3. Set-up the password for root with "mysql_secure_installation"
  4. See if there's a password set in `/etc/mysql/debian.cnf`

 

Is this a local or a server installation by the way? Because on a server installation, actively having a root password might not be the best idea

 

If one of them succeeds, you can use that to log in via PMA


StevieT

702 posts

Ultimate Geek


  #3168062 4-Dec-2023 17:10
Send private message

Firesphere:

 

In the instructions you linked, nowhere do I see the set-up of the root password.

 

So a few options, all from terminal:

 

     

  1. Try logging in with "sudo mysql"
  2. Scour the logs for the generated password in /var/logs/mysql*
  3. Set-up the password for root with "mysql_secure_installation"
  4. See if there's a password set in `/etc/mysql/debian.cnf`

 

Is this a local or a server installation by the way? Because on a server installation, actively having a root password might not be the best idea

 

If one of them succeeds, you can use that to log in via PMA

 

 

I set a password at installation of MySQL. That I am unable to use to log into PHPMyAdmin.


michaelmurfy
meow
13265 posts

Uber Geek

Moderator
ID Verified
Trusted
Lifetime subscriber

  #3168076 4-Dec-2023 17:17
Send private message

This is intentional.

 

Normally you won't be able to use root to login to PMA as this is a substantial security risk. It is to stop people doing silly things. You should NEVER use the root user for anything but creating another user.

 

You need to use mysql to create another user (eg - admin) with the permissions you want.

 

sudo mysql -u root -p
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

 

Replace "newuser" and "password" with a username and a secure password.





Michael Murphy | https://murfy.nz
Referral Links: Quic Broadband (use R122101E7CV7Q for free setup)

Are you happy with what you get from Geekzone? Please consider supporting us by subscribing.
Opinions are my own and not the views of my employer.


fe31nz
1233 posts

Uber Geek


  #3168202 5-Dec-2023 00:36
Send private message

michaelmurfy:

 

This is intentional.

 

Normally you won't be able to use root to login to PMA as this is a substantial security risk. It is to stop people doing silly things. You should NEVER use the root user for anything but creating another user.

 

You need to use mysql to create another user (eg - admin) with the permissions you want.

 

sudo mysql -u root -p
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

 

Replace "newuser" and "password" with a username and a secure password.

 

 

There is a difference between using -u root and just running mysql from the root user without any -u option.  If you use -u, then that specific user named "root" must exist in the MySQL database and have the required permissions to create users and set privileges.  To always get full permissions to do anything (including creating users and setting privileges), you should just use "sudo mysql".  You will be prompted for a password by the sudo command, but the mysql command will not ask for one.  The problem you are avoiding here is that sometimes the user "root" in the MySQL database has been changed to have limited capabilities, and may not be able to do the required CREATE or GRANT commands.  Logging into mysql from the root user but not specifying a user name to log in as bypasses this and gives you full control of everything.


Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.