Control Web Panel

WebPanel => Information => Topic started by: Dragan on April 30, 2019, 09:42:13 PM

Title: mysqli_error()
Post by: Dragan on April 30, 2019, 09:42:13 PM
Hello,

I have a problem logging on to the server.
This is a mistake.

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:



When try restart MySQL server:

service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
Failed to restart mysqld.service: Unit not found


Can you help me, please ?


Title: Re: mysqli_error()
Post by: cu-olly on April 30, 2019, 11:42:30 PM
Not a good error. Looks like your MySQL/MariaDB server has been removed. Without seeing the server in more detail it's hard to say what has happened or how. I expect you added a custom repo and it's wreaked havoc during an automated update.

You could try "yum install mariadb-server" and seeing what happens. It'd be unusual for your /var/lib/mysql data directory to be touched or removed, so you hopefully haven't lost anything. Nonetheless, this is a serious error and I do hope you have backups.

If you're seeing this error right away after a brand new CWP installation, reload the OS from scratch.
Title: Re: mysqli_error()
Post by: Dragan on May 01, 2019, 05:09:46 PM
I installed MariaDB and now this is a new mistake.

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:
Title: Re: mysqli_error()
Post by: cu-olly on May 01, 2019, 05:31:05 PM
Okay, so it looks like you've actually lost your MySQL data somehow. Something or someone has uninstalled MySQL/MariaDB, then reinstalled it and ran the mysql_secure_installation wizard. The chances of you getting any of your data back are very slim. You should bring in a sysadmin at this point if you want to try recovering anything.

To be perfectly honest, this is the time you should either restore back to a time when this wasn't a problem, or spin up a new server and migrate your sites to it. Trying to fix this when somebody/something has been playing with the OS is never going to end well.
Title: Re: mysqli_error()
Post by: Dragan on May 01, 2019, 05:49:04 PM
it seems that the data is not lost is only the problem is to connect MySQL and db_conn.php

in /var/lib/mysql have all.

now my sites are working only I can not log in CWP panel.
https://mdentity.app/index.php/signin working.

Is there any script that fixes MySQL passwords?
Title: Re: mysqli_error()
Post by: cu-olly on May 01, 2019, 06:06:17 PM
I'm not even going to bother here, wasting my keystrokes.

Good luck with your broken server.
Title: Re: mysqli_error()
Post by: Netino on May 01, 2019, 10:02:16 PM
1) You must restart mariadb server with the mariadb unit.
The command is:
(for CentOS7):
Code: [Select]
# systemctl restart mariadb

or
(for CentOS6):
Code: [Select]
# service mariadb restart

2) ** Important (as your error message itself):
===========================================================================================
**Check your MySQL root password in: /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php and /root/.my.cnf
===========================================================================================

This means the root password in file:
     /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php
and in the file:
     /root/.my.cnf
must be exactly the same.

Regards,
Netino
Title: Re: mysqli_error()
Post by: Dragan on May 02, 2019, 09:14:13 AM
Password in /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php is the same as in /root/.my.cnf, I checked.

When I try sh /scripts/mysql_pwd_reset

Error is:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")
Cleaning up...
Stopping mysqld (via systemctl):                           [  OK  ]
mysqld: no process found
Starting mysqld (via systemctl):                           [  OK  ]
 ERROR! MariaDB is not running

service mariadb status shows mariadb working.
Title: Re: mysqli_error()
Post by: Dragan on May 02, 2019, 10:05:17 AM
I solved the problem.
Thank you all.
Now everything works.
Title: Re: mysqli_error()
Post by: GTMAN on May 02, 2019, 04:51:24 PM
I solved the problem.
Thank you all.
Now everything works.

Thanks for sharing the answer >:(
Title: Re: mysqli_error()
Post by: Dragan on May 03, 2019, 10:35:50 AM
I'm insulting because I did not come to explain what was the problem.

I solved the problem by installing MariaDB again.
In /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php and /root/.my.cnf I put in the password that was in the beginning (I took a picture on the phone before I changed anything.)

MySQL database password and password used for encryptions is not they were not properly tuned.

Someone deinstalled MariaDB and it made all the trouble.
If you have this problem, first just try to Install MariaDB.
Title: Warning: mysqli_connect(): (HY000/1045)
Post by: MichaelMichel on May 03, 2019, 05:09:44 PM
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:



[root@host ~]#  /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php
-bash: /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php: Permission denied

[root@host ~]#  /root/.my.cnf
-bash: /root/.my.cnf: Permission denied
Title: Re: Warning: mysqli_connect(): (HY000/1045)
Post by: robbyq on May 04, 2019, 07:30:03 PM
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:



[root@host ~]#  /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php
-bash: /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php: Permission denied

[root@host ~]#  /root/.my.cnf
-bash: /root/.my.cnf: Permission denied

same problem i think it cwp new version omg
Title: Re: mysqli_error()
Post by: Igor S. on May 08, 2019, 07:03:05 AM
Hi, what exactly you trying with the things below?

Quote
[root@host ~]#  /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php
-bash: /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php: Permission denied

[root@host ~]#  /root/.my.cnf
-bash: /root/.my.cnf: Permission denied

Just run the command:
Code: [Select]
/scripts/mysql_pwd_reset
Title: Re: mysqli_error()
Post by: smartelite on May 31, 2020, 10:24:29 AM
Hello

I have the same issue and resolve it without change password

go to

Quote
/etc/my.cnf

you will find it like :

Quote
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
performance-schema=0

#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
 innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
 join_buffer_size = 1028M
 sort_buffer_size = 200M
 read_rnd_buffer_size = 20M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
innodb_buffer_pool_size=25165824
max_allowed_packet=268435456
open_files_limit=100000
innodb_file_per_table=1

remove it and use this

Quote
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d


after that restart all cwp service

Code: [Select]
sh /scripts/restart_cwpsrv

I hope this it will help you.
Title: Re: mysqli_error()
Post by: Igor S. on June 18, 2020, 08:25:18 AM
Are you serious? NEVER delete anything you do not understand!
I hope everybody understands you kidding
Title: Re: mysqli_error()
Post by: marthaneilson on July 14, 2020, 09:00:09 AM
One can try "yum install mariadb-server" and see what happens. Your database is affected or deleted by / var / lib / mysql, so we hope you didn't miss anything. Anyway, it was a big mistake and I hope you get your backup.
Title: Re: mysqli_error()
Post by: Fisnik Myrtezaj on November 12, 2020, 07:43:26 AM
 /etc/systemd/system/mariadb.service.d
           `-migrated-from-my.cnf-settings.conf
   Active: activating (start) since Thu 2020-11-12 02:42:09 EST; 173ms ago
     Docs: man:mariadbd(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 17985 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 17982 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 17996 ((mariadbd))
   CGroup: /system.slice/mariadb.service
           `-17996 (mar
Title: Re: mysqli_error()
Post by: Igor S. on November 22, 2020, 05:58:08 AM
/etc/systemd/system/mariadb.service.d
           `-migrated-from-my.cnf-settings.conf
   Active: activating (start) since Thu 2020-11-12 02:42:09 EST; 173ms ago
     Docs: man:mariadbd(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 17985 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 17982 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 17996 ((mariadbd))
   CGroup: /system.slice/mariadb.service
           `-17996 (mar

And what do you think we can see there? :D
Title: Re: mysqli_error()
Post by: cinique on November 22, 2020, 11:23:29 AM
And what do you think we can see there? :D
LOL  ;D
Someone who doesn't wrap code in tags, is the only error that I can spot.  ;)
Title: Re: mysqli_error()
Post by: Igor S. on November 24, 2020, 09:28:30 AM
@cynique do not advise if you do not understand what are you talking about!
Title: Re: mysqli_error()
Post by: cinique on November 24, 2020, 10:36:39 AM
Igor S.
You are normally one of the better ones here - you're beginning to sound like one of the other members of the Team. :(
I was actually complimenting you, on your reply.
Title: Re: mysqli_error()
Post by: bluebrad on February 26, 2021, 07:48:45 PM
i checked my passwords and there the same?

1) You must restart mariadb server with the mariadb unit.
The command is:
(for CentOS7):
Code: [Select]
# systemctl restart mariadb

or
(for CentOS6):
Code: [Select]
# service mariadb restart

2) ** Important (as your error message itself):
===========================================================================================
**Check your MySQL root password in: /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php and /root/.my.cnf
===========================================================================================

This means the root password in file:
     /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php
and in the file:
     /root/.my.cnf
must be exactly the same.

Regards,
Netino
Title: Re: mysqli_error()
Post by: Igor S. on March 08, 2021, 06:11:08 AM
> i checked my passwords and there the same?

Then check if you are able to connect as root to MySQL with the password.
Make sure you have enough disk space also.
Title: Re: mysqli_error()
Post by: jk22 on July 28, 2023, 05:43:54 PM
I solved the problem.
Thank you all.
Now everything works.

Can you tell me how you solved the problem ?
Title: Re: mysqli_error()
Post by: heart2hack on August 18, 2023, 12:52:48 PM
I am getting the issue today and mariadb is not starting, upon investigating the issue I was getting mariadb corrupt table, so I insert
Code: [Select]
innodb_force_recovery = 5into the my.cnf file. what it did was, all my site are up.

but now, I am getting issue with cwp admin login. so I reset the mysql root password, it was successfully reset, and also change the root password, but still getting the above message
Title: Re: mysqli_error()
Post by: heart2hack on August 18, 2023, 01:02:25 PM
when I insert
Code: [Select]
innodb_force_recovery = 5in configuration file of mysql, all the websites get up and databases get up, but cwp admin panel login doesn't work after that and getting error.
Title: Re: mysqli_error()
Post by: overseer on August 19, 2023, 02:38:32 AM
You need to get mariadb fully functional before CWP will function properly. You may need to repair your tables, delete your log files (ib_logfile0 and ib_logfile1), or roll back to a backup (or recreate the root_cwp database) in order to get fully stabilized.