Author Topic: Cannot connect to MySQL, db_conn.php is missing  (Read 43038 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Cannot connect to MySQL, db_conn.php is missing
« on: April 16, 2018, 01:10:29 AM »
Clean installation of CentOS 7 and CWP Control Web Panel. No errors anywhere.

Upon final reboot, I am able to access the login page for the control panel, but upon attempting to log in, I get the following error page:

Code: [Select]
Warning: main(../../resources/admin/include/db_conn.php): failed to open stream: No such file or directory in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0

Warning: main(../../resources/admin/include/db_conn.php): failed to open stream: No such file or directory in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0

Warning: main(): Failed opening '../../resources/admin/include/db_conn.php' for inclusion (include_path='.:/usr/local/cwp/php71/lib/php') in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0

Warning: main(/usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php): failed to open stream: No such file or directory in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Warning: main(): Failed opening '/usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php' for inclusion (include_path='.:/usr/local/cwp/php71/lib/php') in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Notice: Undefined variable: db_host in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Notice: Undefined variable: db_user in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Notice: Undefined variable: db_pass in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Notice: Undefined variable: db_name in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Warning: mysqli_connect(): (HY000/1045): Access denied for user ''@'localhost' (using password: NO) in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Notice: Undefined variable: db_host in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0

Notice: Undefined variable: db_user in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0

Notice: Undefined variable: db_pass in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0

Notice: Undefined variable: db_name in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0

Warning: mysqli_connect(): (HY000/1045): Access denied for user ''@'localhost' (using password: NO) in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0
**Check your MySQL root password in: /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php and /root/.my.cnf


Warning: mysqli_error() expects exactly 1 parameter, 0 given in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0
Could not connect:

Please note:

  • I have confirmed that MySQL is installed and running properly by logging into MySQL using the root password provided during the installation summary.
  • I have re-set the MySQL root password via /scripts/mysql_pwd_reset, and again confirmed that it was up and running by logging in using the new root password provided by the script.
  • I have confirmed that /root/.my.cnf exists and has the proper MySQL root username and password.
  • I have gone to /usr/local/cwpsrv/htdocs/resources/admin/include/ and have confirmed that db_conn.php does NOT exist in that directory.

Essentially, I need to know where I can find a db_conn.php file to shoehorn into the correct directory.

Offline
*
Re: Cannot connect to MySQL, db_conn.php is missing
« Reply #1 on: April 16, 2018, 09:14:35 AM »
your installation wasn't good in some way if you are missing that files, here is part from the installer

Code: [Select]
cd /usr/local/cwpsrv/htdocs/resources/admin/include
wget http://dl1.centos-webpanel.com/files/cwp/sql/db_conn.txt
mv db_conn.txt db_conn.php

now edit this file and set details from /root/.my.cnf
Code: [Select]
nano /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
*
Re: Cannot connect to MySQL, db_conn.php is missing
« Reply #2 on: April 16, 2018, 03:50:49 PM »
The list of errors has shortened dramatically:

Code: [Select]
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0


Trying to start mysql server, please wait!
Try to restart CentOS Web Panel with command: sh /scripts/restart_cwpsrv

**Check your MySQL root password in: /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php and /root/.my.cnf


Warning: mysqli_error() expects exactly 1 parameter, 0 given in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0
Could not connect:

But I am still having problems.

I noticed that in the db_conn.php file, there was an entry for an encryption password. Does this need to be filled in order to clear up more errors?

EDIT: One sec, the password I was successful in logging onto MySQL with last night is no longer being accepted as the MySQL root password. I did *NOT* change it in the meantime.

EDIT 2: Okay, this is VERY, VERY WEIRD: even when I change the password through the change MySQL password script, I am unable to log onto MySQL using the new password. I was able to conduct a change password last night and was able to log into MySQL directly using the new password, but this morning it does not work.

EDIT3: And I Have confirmed that the change password script does change /root/.my.cnf and db_conn.php.

EDIT4: Okay, it is now Whisky Tango Foxtrot time. Remember how I said that one of my first actions were to re-set the MySQL root password? Yes, I did. I really, really did. And I even checked that new password afterwards, by logging straight into MySQL, and it was successful.

I have now discovered that the MySQL change root password script does NOTHING. Yes, it updates /root/.my.cnf and db_conn.php file with the “new” password it creates, but I have just discovered that any new password it creates is not actually used within MySQL. As in, I use the script, but MySQL does not recognize the new password.

In fact, it recognizes only the original password used on system install. It doesn’t even recognize the second password that was set up with my initial script run any more.

So my system now appears to be up and running, error free, using the original system install MySQL password even though the change password script was run, twice.

Confused? Join the club.
« Last Edit: April 16, 2018, 04:27:23 PM by rekabis »

Offline
*
Re: Cannot connect to MySQL, db_conn.php is missing
« Reply #3 on: April 17, 2018, 07:42:29 AM »
set something random for "crypt_pwd" with length as password, you can change your mysql password manually and then update this files

/usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php
/root/.my.cnf
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
*
Re: Cannot connect to MySQL, db_conn.php is missing
« Reply #4 on: May 06, 2018, 08:31:57 PM »
You have to check error log which is in place /usr/local/cwpsrv/logs/error.log

option 1
if you dont have file ~/.my.cnf

2018/05/06 15:52:42 [error] 15352#0: *3609 FastCGI sent in stderr: "PHP message: PHP Warning:  mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0
PHP message: PHP Warning:  mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0
PHP message: PHP Warning:  mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0
PHP message: PHP Warning:  mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0
PHP message: PHP Warning:  mysqli_error() expects exactly 1 parameter, 0 given in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0" while reading response header from upstream, client: XX.XX.XX.XX, server: localhost, request: "GET /admin/index.php?module=crontab HTTP/1.1", upstream: "fastcgi://unix:/usr/local/cwp/php71/var/sockets/cwpsrv.sock:", host: "www.dnsbg.com:2030", referrer: "http://www.domain.com:2030/admin/index.php?module=crontab"

Option 2:

If you have file ~/.my.cnf but information like password is wrong - error will be

2018/05/06 22:53:37 [error] 8815#0: *324 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined variable: pass in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 21
PHP message: PHP Warning:  mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 25
PHP message: PHP Warning:  mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 27
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 29
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) in /usr/local/cwpsrv/var/services/oauth/v2/server/OAuth2/Storage/Pdo.php:67
Stack trace:
#0 /usr/local/cwpsrv/var/services/oauth/v2/server/OAuth2/Storage/Pdo.php(67): PDO->__construct('mysql:dbname=oa...', 'root', ''

What can be wrong in the file ~./.my.cnf

Wrong

~./.my.cnf

[client]
user = root
password = mypassword

~./.my.cnf

Correct ( without space passowrd=mypassword )
[client]
user=root
password=mypassword

Regards,
kkovachki

Offline
*
Re: Cannot connect to MySQL, db_conn.php is missing
« Reply #5 on: July 03, 2018, 08:21:25 AM »
You have to check error log which is in place /usr/local/cwpsrv/logs/error.log

option 1
if you dont have file ~/.my.cnf

2018/05/06 15:52:42 [error] 15352#0: *3609 FastCGI sent in stderr: "PHP message: PHP Warning:  mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0
PHP message: PHP Warning:  mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0
PHP message: PHP Warning:  mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0
PHP message: PHP Warning:  mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0
PHP message: PHP Warning:  mysqli_error() expects exactly 1 parameter, 0 given in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0" while reading response header from upstream, client: XX.XX.XX.XX, server: localhost, request: "GET /admin/index.php?module=crontab HTTP/1.1", upstream: "fastcgi://unix:/usr/local/cwp/php71/var/sockets/cwpsrv.sock:", host: "www.dnsbg.com:2030", referrer: "http://www.domain.com:2030/admin/index.php?module=crontab"

Option 2:

If you have file ~/.my.cnf but information like password is wrong - error will be

2018/05/06 22:53:37 [error] 8815#0: *324 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined variable: pass in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 21
PHP message: PHP Warning:  mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 25
PHP message: PHP Warning:  mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 27
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 29
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /usr/local/cwpsrv/var/services/oauth/v2/server/server.php on line 95
PHP message: PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) in /usr/local/cwpsrv/var/services/oauth/v2/server/OAuth2/Storage/Pdo.php:67
Stack trace:
#0 /usr/local/cwpsrv/var/services/oauth/v2/server/OAuth2/Storage/Pdo.php(67): PDO->__construct('mysql:dbname=oa...', 'root', ''

What can be wrong in the file ~./.my.cnf

Wrong

~./.my.cnf

[client]
user = root
password = mypassword

~./.my.cnf

Correct ( without space passowrd=mypassword )
[client]
user=root
password=mypassword

Regards,
kkovachki


Thank you, i have same error. how to fix ?

Offline
*
helo
i have sql error :

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0


Trying to start mysql server, please wait!
Try to restart CentOS Web Panel with command: sh /scripts/restart_cwpsrv

**Check your MySQL root password in: /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php and /root/.my.cnf


Warning: mysqli_error() expects exactly 1 parameter, 0 given in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0
Could not connect:

Offline
**
Re: Cannot connect to MySQL, db_conn.php is missing
« Reply #7 on: May 04, 2019, 06:53:07 PM »
same too bad...

Code: [Select]
Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0

Warning: mysqli_connect(): (HY000/2002): No such file or directory in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0


Trying to start mysql server, please wait!
Try to restart CentOS Web Panel with command: sh /scripts/restart_cwpsrv

**Check your MySQL root password in: /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php and /root/.my.cnf


Warning: mysqli_error() expects exactly 1 parameter, 0 given in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0
Could not connect:

SH for change pss root mysql.

See config root and password change, reboot server and nothing...

this i see

Code: [Select]
systemctl status mariadb.service
● mariadb.service - MariaDB 10.1.37 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: failed (Result: exit-code) since sáb 2019-05-04 20:55:05 CEST; 4s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 7630 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
  Process: 7618 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 7616 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 7630 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"

may 04 20:55:03 x mysqld[7630]: 2019-05-04 20:55:03 140699008465152 [Note] InnoDB: Waiting for purge to start
may 04 20:55:03 x mysqld[7630]: 2019-05-04 20:55:03 140699008465152 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.41-84.1 started; log sequence number 1347895500
may 04 20:55:03 x mysqld[7630]: 2019-05-04 20:55:03 140699008465152 [Note] Plugin 'FEEDBACK' is disabled.
may 04 20:55:03 x mysqld[7630]: 2019-05-04 20:55:03 140699008465152 [Note] Recovering after a crash using tc.log
may 04 20:55:03 x mysqld[7630]: 2019-05-04 20:55:03 140699008465152 [ERROR] Can't init tc log
may 04 20:55:03 x mysqld[7630]: 2019-05-04 20:55:03 140699008465152 [ERROR] Aborting
may 04 20:55:05 x systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
may 04 20:55:05 x systemd[1]: Failed to start MariaDB 10.1.37 database server.
may 04 20:55:05 xsystemd[1]: Unit mariadb.service entered failed state.
may 04 20:55:05 x systemd[1]: mariadb.service failed.
[root@vps582806 scripts]#
« Last Edit: May 04, 2019, 06:56:53 PM by robbyq »

Offline
*****
Re: Cannot connect to MySQL, db_conn.php is missing
« Reply #8 on: May 08, 2019, 07:08:20 AM »
Hi, have you tried? Probably you have changed the password manually or your SQL server stopped.
Code: [Select]
sh /scripts/mysql_pwd_reset
You can ask me to solve any problem with your server for some money in pm  ;)
Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor
Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp

Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services