0

How can I find the password for my database on phpMyAdmin? I want to connect mySQL database just by using mysqli_connect and understand that three strings are needed, but I can't seem to find where the password could be. If anyone could help that would be great. Thanks

2
  • Is this a new install? How did you install it? What MySQL version? – danblack Dec 12 '20 at 20:46
  • Nah, I never installed it. I just created a database name through cPanel and added columns to it on phpMyAdmin, which I also accessed through cPanel. Should I install MySQL? – dsonawave Dec 12 '20 at 20:55
0

You can do it with some simple commands:

sudo su

cd /etc/mysql
cat my.cnf

When the file my.cnf is opened you can read it's contents, and it should contain your username and password for the current installation.

Hope this helps! ;)

2
  • ok, I'm assuming I would have to install mySQL then in order to do this. Correct? – dsonawave Dec 12 '20 at 21:01
  • Of course, but it shouldn't be hard. – Shannarra Dec 12 '20 at 21:04
0

cPanel documentation says the password is stored in /root/.my.cnf.

Use this user/password to create a new user for your mysql application.

1
  • where do I find /root/.my.cnf.? I just finished installing it and I'm on the mySQL workbench plugin, what's next? – dsonawave Dec 12 '20 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.