Want more timely Centmin Mod News Updates?
Become a Member

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Discussion in 'Install & Upgrades or Pre-Install Questions' started by modder, Aug 25, 2024.

  1. modder

    modder Member

    117
    16
    18
    Dec 6, 2019
    Ratings:
    +27
    Local Time:
    7:27 PM
    How can I get rid of this ERROR?

    upload_2024-8-24_22-36-26.png

     
  2. eva2000

    eva2000 Administrator Staff Member

    53,247
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    9:27 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Is this a recent fresh Centmin Mod 140.00beta01 install and you got this error immediately after install or was it working fine for ages and only recently showed the error?

    When you SSH login type the following commands and copy and paste their output as CODE/CODEB BBCODE wrapped output
    Code (Text):
    id && mysql -e "SELECT VERSION();"
    

    and
    Code (Text):
    mysqladmin -V

    The 2nd command is ran on centmin.sh menu run to get the MariaDB MySQL version number for centmin.sh tasks (specifically conditionally setting MariaDB alias commands in preparation for MariaDB 11.4+ deprecation of mysql* client program names for mariadb* client program names).

    When Centmin Mod installs MariaDB, it generates a MySQL root user password and also sets it in /root/.my.cnf to allow for running MariaDB client commands without passing the MySQL root user password on command line. So you can run
    Code (Text):
    mysqladmin -V

    instead of
    Code (Text):
    mysqladmin -uroot -pYOURROOTPASSWORD -V


    Now if you changed the MySQL root user password yourself outside of centmin.sh menu option 11 submenu option 0, then you will need to manually update /root/.my.cnf with the changed MySQL root user password. If you used centmin.sh menu option 11 submenu option 0 to reset MySQL root user password, then the routine should automatically have updated /root/.my.cnf with the changed MySQL root user password.

    One other reason is the initial install generated MySQL root user password set in /root/.my.cnf might have invalid characters which MariaDB MySQL server isn't reading correctly i.e. single or double quotation marks in generated password which cut off the full password read by MariaDB MySQL server i.e. like
    Code (Text):
    [client]
    user=root
    password='ZkhomKxfcaQn'PZn2ps
    

    MariaDB MySQL server might only read the characters between single quotes ZkhomKxfcaQn. Though Centmin Mod should filter out such invalid characters by default already.

    Code (Text):
    --------------------------------------------------------
         MariaDB MySQL Upgrade & Management Sub-Menu       
    --------------------------------------------------------
    0). Regenerate New MySQL Root User Password (local server)
    1). MariaDB 5.2.x Branch Upgrade Only
    2). MariaDB 5.2.x to MariaDB 5.5 YUM upgrade
    3). MariaDB 5.5 to MariaDB 10.x YUM upgrade
    4). MariaDB 5.5 to MariaDB 10.1.x YUM upgrade
    5). MariaDB 10.x to MariaDB 10.1.x YUM upgrade
    6). MariaDB 10.1.x to MariaDB 10.2.x YUM upgrade
    7). MariaDB 10.2.x to MariaDB 10.3.x YUM upgrade
    8). MariaDB 10.3.x to MariaDB 10.4.x YUM upgrade
    9). MariaDB 10.4.x to MariaDB 10.5.x YUM upgrade
    10). MariaDB 10.5.x to MariaDB 10.6.x LTS YUM upgrade
    11). MariaDB 10.6.x to MariaDB 10.11.x YUM upgrade
    12). MariaDB 10.6.x to MariaDB 11.4.x LTS YUM upgrade
    13). MariaDB 10.11.x to MariaDB 11.4.x LTS YUM upgrade
    14). Back to Main menu
    --------------------------------------------------------
    


    For folks reading this message and yourself for posting code or output from commands to keep the formatting, you might want to use CODE tags for code How to use forum BBCODE code tags :)

    Please fill in any relevant information that applies to you:
    • CentOS Version: i.e. CentOS 7 64bit / AlmaLinux / Rocky Linux 8/9 ?
    • Centmin Mod Version Installed: i.e. 124.00stable or 130.00beta01 or 131.00stable or 140.00beta01
    • Nginx Version Installed: i.e. 1.25.4, 1.24.0, 1.26.1, 1.27.0 ?
    • PHP Version Installed: i.e. 7.3.33, 7.4.33, 8.0.30, 8.1.29, 8.2.21, 8.3.9
    • MariaDB MySQL Version Installed: i.e. 10.3.xx or 10.4.xx or 10.6.xx
    • When was last time updated Centmin Mod code base ? : i.e. run centmin.sh menu option 23 submenu option 2 or cmupdate command
    • Persistent Config: Do you have any persistent config file options set in /etc/centminmod/custom_config.inc ? You can check via this command:
      Code (Text):
      cat /etc/centminmod/custom_config.inc
      

      Post output in CODE or CODEB bbcode tags.
     
  3. modder

    modder Member

    117
    16
    18
    Dec 6, 2019
    Ratings:
    +27
    Local Time:
    7:27 PM
    It's a fresh install on a new VPS AlmaLinux 9 server.

    I installed it by the following commands:

    Code (Text):
    Disable SELinux
    
    [root@mainhost ~]# sudo grubby --update-kernel ALL --args selinux=0
    [root@mainhost ~]# sudo reboot
    [root@mainhost ~]# getenforce
    Disabled
    
    Install Centminmod
    
    [root@mainhost ~]# yum -y update
    [root@mainhost ~]# curl -O https://centminmod.com/betainstaller83.sh && chmod 0700 betainstaller83.sh && bash betainstaller83.sh
    


    I'll installing it again as there seems to be some other errors after I installed the vhost. So I start over again just to make sure I do everything correct.

    I'll follow your instruction and show the output of those commands later.
     
  4. modder

    modder Member

    117
    16
    18
    Dec 6, 2019
    Ratings:
    +27
    Local Time:
    7:27 PM
    Tested. You provided the correction reasoning.

    Code (Text):
    # mysqladmin -uroot -p'Mdja8sPLPASSWORDj2VpDKID' password
    


    doesn't automatically update the password in /root/.my.cnf which results in the error. I need to manually update it in the file.

    Anyway I didn't need to do the manual update in the past (with the previous version of centmin).
     
  5. eva2000

    eva2000 Administrator Staff Member

    53,247
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    9:27 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Fresh Centmin Mod Install on frsh Operating systems did not setup /root/.my.cnf password correctly or centmin.sh menu option 11 submenu option 0 reset did not setup /root/.my.cnf password correctly ?

    If /root/.my.cnf setup
    Code (Text):
    password='Mdja8sPLPASSWORDj2VpDKID'
    full password wrapped in single quotes that is OK. It's only when characters are outside of start and end quotations that is an issue

    So this should work

    Code (Text):
    mysqladmin -uroot -pMdja8sPLPASSWORDj2VpDKID -V
     
  6. eva2000

    eva2000 Administrator Staff Member

    53,247
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    9:27 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  7. modder

    modder Member

    117
    16
    18
    Dec 6, 2019
    Ratings:
    +27
    Local Time:
    7:27 PM
    Not sure about the initial password because I didn't really check the ~/.my.cnf after installing centmin.


    For now, centmin option 11-0,
    Code (Text):
    # cat ~/.my.cnf
    [client]
    user=root
    password=RWg2rP84GcroSWz1ArTEzmNAsRl1AQbblI


    no quotes.
     
  8. eva2000

    eva2000 Administrator Staff Member

    53,247
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    9:27 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    of this command works, then your MySQL root password is working
    Code (Text):
    mysqladmin -uroot -pRWg2rP84GcroSWz1ArTEzmNAsRl1AQbblI -V
    
     
  9. modder

    modder Member

    117
    16
    18
    Dec 6, 2019
    Ratings:
    +27
    Local Time:
    7:27 PM
    Yes it's working now.