Welcome Guest, Not a member yet? Register   Sign In
proper database security
#1

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 127.0.0.1/phpmyadmin. 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?
proof that an old dog can learn new tricks
Reply
#2

(This post was last modified: 09-02-2018, 03:51 AM by InsiteFX. Edit Reason: Add remark out )

Add this:

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

Code:
C:\xampp\mysql\bin\my.ini

[mysqld]
##
## SET PASSWORD FOR 'root'@'localhost' = PASSWORD('YourNewPassword');
##
skip-grant-tables

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.

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

or - If you get an SQL Error.

2)
Code:
UPDATE mysql.user SET Password=PASSWORD('YourNewPassword')
WHERE User='root';
FLUSH PRIVILEGES;

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

Restart your MySQL Server.

Hope that helps.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Thx. Which hard drive do I this on? My local pc or the hosted lamp server's?
proof that an old dog can learn new tricks
Reply
#4

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

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!
proof that an old dog can learn new tricks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB