PhpMyadmin Installation

From ScottWiki
Revision as of 16:21, 15 December 2022 by Wikiadmin (talk | contribs) (1 revision imported)
Jump to navigation Jump to search

Install PHPmyAdmin.

OK lets install a web interface into the MySql Server, as this makes administration much easier

sudo apt-get install phpmyadmin

Select the web server(s) that you have installed (usually APACHE2) Go in and set the root password for MySql if you have not done so already.

You can test this now http://your.server.com/phpmyadmin

go and log in with the root password


OOOPS You’ve installed phpMyAdmin but cannot log in using the root account.

mysqli_real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'

This is because MySQL is not allowing remote users to log in as root for security reasons. It’s possible this was specified when you installed MySQL for the first time and ran the mysql_secure_installation tool.

It’s not recommended that you allow the root account to be accessible remotely via phpMyAdmin as bots and hackers scan for these accounts continuously.

Instead, create a new superuser account with a different username.

In terminal, log into MySQL as root. You may have created a root password when you installed MySQL for the first time or the password could be blank, in which case you can just press ENTER when prompted for a password.

sudo mysql -p -u root

Now add a new MySQL user with the username of your choice. In this example we are calling it pmauser (for phpmyadmin user). Make sure to replace password_here with your own. You can generate a password here. The % symbol here tells MySQL to allow this user to log in from anywhere remotely. If you wanted heightened security, you could replace this with an IP address.

CREATE USER 'userxxxx'@'%' IDENTIFIED BY 'password_here';

Now we will grant superuser privilege to our new user.

GRANT ALL PRIVILEGES ON *.* TO 'userxxxx'@'%' WITH GRANT OPTION;

You should now be able to access phpMyAdmin using this new user account.