Skip to main content

mysqlcheck access denied for user root@localhost

Comments

8 comments

  • GoMummyHosting
    Hello, When you execute # mysqlcheck -u root -p --all-databases, it will ask for mysql's root pass so just enter the pass, then it will perform the checking.
    0
  • Jon Erickson
    As I mentioned above, yes I know, and the script works correctly. However when WHM executes via cron, that"s when I get the error.
    0
  • cPanelLauren
    Hello, What's in the script exactly? (don't add the exact password here)
    0
  • Jon Erickson
    @cPanelLauren This is your companies script. I didn't create it. I am not actually sure where to find it. It's not easy to tell in the /scripts folder. All I know is it appears to be executing with the system cron.
    0
  • Jon Erickson
    @cPanelLauren - actually it appears to be the default check_mysql script in /scripts.
    0
  • Jon Erickson
    Sorry for all the posts but I seem to have fixed it. I had to use mysql_config_editor to reset the client login-path with the right username and password. For some reason when I change the root password in WHM, it does not update .mylogin.cnf but it does change .my.cnf. Do you know why this might be,
    0
  • cPanelLauren
    @cPanelLauren This is your companies script. I didn't create it. I am not actually sure where to find it. It's not easy to tell in the /scripts folder. All I know is it appears to be executing with the system cron.

    Your response does not indicate what is running, I have no way to know if its a customization or something provided by cPanel or otherwise. It's always best to be detailed in your threads, we don't have the privilege of having access to your server to view the configuration. It might seem ridiculous to you that we ask some of the questions we do but I guarantee you there is a reason for them being asked. Neither of the scripts you're referencing in this instance are items that cPanel maintains or provides: /usr/local/cpanel/3rdparty/bin/mysqlcheck
    MYSQLCHECK(1) NAME mysqlcheck - a table maintenance program SYNOPSIS mysqlcheck [options] [db_name [tbl_name ...]] DESCRIPTION The mysqlcheck client performs table maintenance: It checks, repairs, optimizes, or analyzes tables. Each table is locked and therefore unavailable to other sessions while it is being processed, although for check operations, the table is locked with a READ lock only. Table maintenance operations can be time-consuming, particularly for large tables. If you use the --databases or --all-databases option to process all tables in one or more databases, an invocation of mysqlcheck might take a long time. (This is also true for mysql_upgrade because that program invokes mysqlcheck to check all tables and repair them if necessary.) mysqlcheck is similar in function to myisamchk, but works differently. The main operational difference is that mysqlcheck must be used when the mysqld server is running, whereas myisamchk should be used when it is not. The benefit of using mysqlcheck is that you do not have to stop the server to perform table maintenance. mysqlcheck uses the SQL statements CHECK TABLE, REPAIR TABLE, ANALYZE TABLE, and OPTIMIZE TABLE in a convenient way for the user. It determines which statements to use for the operation you want to perform, and then sends the statements to the server to be executed.
    /usr/local/cpanel/3rdparty/bin/mysql_config_editor
    Is a MySQL script: # head -50 /usr/local/cpanel/3rdparty/share/man/man1/mysql_config_editor.1 '\" t .\" Title: \fBmysql_config_editor\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 12/20/2018 .\" Manual: MySQL Database System .\" Source: MySQL 5.6 .\" Language: English .\" .TH "\FBMYSQL_CONFIG_EDITOR\FR" "1" "12/20/2018" "MySQL 5\&.6" "MySQL Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
    With that being said, MySQL is checked periodically if monitored with chksrvd, which would most likely be why the check was being run.
    Sorry for all the posts but I seem to have fixed it. I had to use mysql_config_editor to reset the client login-path with the right username and password. For some reason when I change the root password in WHM, it does not update .mylogin.cnf but it does change .my.cnf. Do you know why this might be,

    I'd assume this to be because the default installation of mysql on cPanel does not include .mylogin.cnf and as such we're not looking for it when updating the username/password for a mysql user. This is created when you use the mysql_config_editor as described in the MySQL Documentation here: cPanel assumes that you'll be making modifications using the interface, rather than making manual changes.
    0
  • Jon Erickson
    The script I"m referring to is check_mysql in /scripts which uses mysqlcheck.
    0

Please sign in to leave a comment.