Author Topic: mysqli_error()  (Read 87678 times)

0 Members and 2 Guests are viewing this topic.

Offline
*
mysqli_error()
« 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 ?



Offline
*
Re: mysqli_error()
« Reply #1 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.

Offline
*
Re: mysqli_error()
« Reply #2 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:

Offline
*
Re: mysqli_error()
« Reply #3 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.

Offline
*
Re: mysqli_error()
« Reply #4 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?

Offline
*
Re: mysqli_error()
« Reply #5 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.

Offline
***
Re: mysqli_error()
« Reply #6 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
« Last Edit: May 01, 2019, 10:04:34 PM by Netino »

Offline
*
Re: mysqli_error()
« Reply #7 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.

Offline
*
Re: mysqli_error()
« Reply #8 on: May 02, 2019, 10:05:17 AM »
I solved the problem.
Thank you all.
Now everything works.

Offline
**
Re: mysqli_error()
« Reply #9 on: May 02, 2019, 04:51:24 PM »
I solved the problem.
Thank you all.
Now everything works.

Thanks for sharing the answer >:(

Offline
*
Re: mysqli_error()
« Reply #10 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.

Offline
*
Warning: mysqli_connect(): (HY000/1045)
« Reply #11 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

Offline
**
Re: Warning: mysqli_connect(): (HY000/1045)
« Reply #12 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

Offline
*****
Re: mysqli_error()
« Reply #13 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
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

Offline
*
Re: mysqli_error()
« Reply #14 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.
« Last Edit: May 31, 2020, 10:26:27 AM by smartelite »