Apache2 error on linux

Asked

Viewed 50 times

0

Guys installed everything right on Linux, I played my folder in the directory www when I opened in the broswer I received the following warning:

Access denied for user 'root@localhost' (using password: NO)

How do I resolve?

  • This looks like mysql access error, check your connection file if you are not password-passing with the user. It is recommended that you add a password, even if it is only in local environment.

  • I tried to reset a password now in mysql but only get the same error 1045

  • Make sure the mysql port is open (nmap localhost). See help: http://askubuntu.com/a/272435/436114

  • You can post the code you are using in connection with the bank?

3 answers

1

In the mysql_connect you are passing a password to connect to the bank at localhost.

However the user root no password. Then just remove the password you are going through and try again.

mysql_connect ('localhost','root','');

1

1) This is not a problem with Apache2, but a connection to Mysql.

2) You are trying to access Mysql with the root user on localhost without using a password (using password: NO), but root must have one (it’s the opposite of rubStackOverflow said).

3) If possible, avoid using PHP’s mysql_* functions because they are obsolete and no longer work in PHP 7.0. Give preference to PDO.

0

You can reset your root password. Keep in mind that it is not advisable to use root without password. Soon after you have to restart the service so that the changes work properly using:

sudo /etc/init.d/mysql restart

Browser other questions tagged

You are not signed in. Login or sign up in order to post.