Control Web Panel

WebPanel => CentOS 7 Problems => Topic started by: thanhblog.info on May 01, 2019, 04:34:49 PM

Title: Can you help me plzz
Post by: thanhblog.info on May 01, 2019, 04:34:49 PM
My vps is have problem:

Quote
Warning: mysqli_connect(): (HY000/1049): Unknown database 'root_cwp' in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'postfix'@'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 'postfix'@'localhost' (using password: YES) in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0

Warning: mysqli_connect(): (HY000/1049): Unknown database 'root_cwp' 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:

Plz help me. Tks all so much!
Title: Re: Can you help me plzz
Post by: Netino on May 01, 2019, 10:05:58 PM
** 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.

Check that.

Regards,
Netino
Title: Re: Can you help me plzz
Post by: thanhblog.info on May 02, 2019, 08:12:40 AM
root password is same, but this not action. Can you help me! Tks
Title: Re: Can you help me plzz
Post by: Igor S. on May 10, 2019, 08:53:34 AM
Hello.

Try to check if MySQL server is active and has root_cwp database.
Title: Re: Can you help me plzz
Post by: leebrimlow on May 30, 2019, 09:23:32 AM
I had the same issue , this code saved me.

login using SSH and paste the code:
# systemctl stop mysqld

#systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

# systemctl start mysqld

i hope it works for you :)
Title: Re: Can you help me plzz
Post by: Igor S. on May 31, 2019, 12:31:57 PM
I had the same issue , this code saved me.

login using SSH and paste the code:
# systemctl stop mysqld

#systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

# systemctl start mysqld

i hope it works for you :)


Never do things like that!!!
Title: Re: Can you help me plzz
Post by: adamjedgar on May 31, 2019, 05:32:36 PM
Here is a post on stack exchange about doing this to regain access to root user account...

How to re-take control of the root user in MySQL.

DANGER: RISKY OPERATTION

Start session ssh (using root if possible).
Edit my.cnf file using.

sudo vi /etc/my.cnf
Add line to mysqld block.*

skip-grant-tables
Save and exit.

Restart MySQL service.

service mysql restart
Check service status.

service mysql status
Connect to mysql.

mysql
Using main database.

use mysql;
Redefine user root password.

UPDATE user SET `authentication_string` = PASSWORD('myNuevoPassword') WHERE `User` = 'root';
Edit file my.cnf.

sudo vi /etc/my.cnf
Erase line.

skip-grant-tables
Save and exit.

Restart MySQL service.

service mysqld restart
Check service status.

service mysql status
Connect to database.

mysql -u root -p
Type new password when prompted.

This action is very dangerous, it allows anyone to connect to all databases with no restriction without a user and password. It must be used carefully and must be reverted quickly to avoid risks.
Title: Re: Can you help me plzz
Post by: Igor S. on June 01, 2019, 09:57:59 AM
Hi, just run the next two commands if you'd like to change the MySQL root password:
Code: [Select]
/scripts/mysql_pwd_reset
cat /root/.my.cnf