CodeIgniter Forums

Full Version: proper database security
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have just moved my app over to Ubuntu  on a publicly accessible server. I am getting the following warning followed by an error:

Severity: Warning
Message: mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
Filename: mysqli/mysqli_driver.php
Line Number: 201

And here is the database.php that appears on my local PC.
$db['default'] = array(
  'dsn'  => '',
  'hostname' => 'localhost',
  'username' => 'root',
   'password' => 'xxxx',


I must admit, I am totally confused about the use of phpmyadmin on a remote Ubuntu server. It is not clear to me if I am running two separate copies of phpMyadmin or a single copy that accesses both my local db and also the one on the LAMP server. Part of the problem is that I was instructed that due to security, I can only access the remote server database by using As I said, I am already running localhost/phpmyadmin on my desktop PC. In setting up Putty I was instructed to use SSH port forwarding to L8888 localhost:80. 

So here is my question. How does my browser know which of the two copies of mysql i am trying to access if they both are called localhost/phpmyadmin? And how can I tell which one I am accessing? They both look the same?
Add this:

Change to your MySQL folder or where your Mysql folder is.


## SET PASSWORD FOR 'root'@'localhost' = PASSWORD('YourNewPassword');

Restart the MySQL server.

Use PhpMyAdmin or other database utility, it should run with no password now.

Next go to the SQL tab and enter one of the below to set a new Password.
Change the YourNewPassword to the one you want to use.

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('YourNewPassword');

or - If you get an SQL Error.

UPDATE mysql.user SET Password=PASSWORD('YourNewPassword')
WHERE User='root';

Re-edit the my.ini and remark out the ##skip-grant-tables

Restart your MySQL Server.

Hope that helps.
Thx. Which hard drive do I this on? My local pc or the hosted lamp server's?
That would be done on your local pc, I use XAMPP so I set it with PhpMyAdmin.

If the error is on your live server then it may not be setup yet,
On my server I have CPanel so I can do everything from there.

After re-reading your topic I see that your getting the error on the live server.

You need to Login into MySQL with your own username and password then you can set it up.

Not sure what they are using for Utilities on it.
Thanks for the help. I think I was logging into the local server's phpmyadin instead of the AWS servers'. I know this because when I take down wamp on my local pc I can no longer log in. The bottom line is that my password that works fine on the WordPress instance just won't work on the lamp one. Very discouraging. I must have installed and deleted it 5 times. Ugh!