Want more timely Centmin Mod News Updates?
Become a Member

MariaDB Getting Error while installing Wordpress mysqladmin: connect to server at 'localhost' failed

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pheonis, Jan 19, 2019.

  1. pheonis

    pheonis Member

    51
    3
    8
    Dec 21, 2018
    Ratings:
    +4
    Local Time:
    1:22 PM
    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS7 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • nginx version: nginx/1.15.7PHP Version Installed:PHP 7.3.0
    • MariaDB MySQL Version Installed:mysql Ver 15.1 Distrib 10.1.37-MariaDB
    • cmupdate: Already up to date
    • Persistent Config Output:No such file or directory
    While installing wordpress via menu 22 i got the following error
    Code:
    updating...
    -------------------------------------------------------------
    update wp-cli packages
    Using Composer to update packages...
    ---
    Loading composer repositories with package information
    Warning: The "https://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection timed out
    ---
    Error: Failed to update packages.
    -------------------------------------------------------------
    update wp-cli
    2019-01-19 03:05:15 URL:https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar [5421617/5421617] -> "/usr/bin/wp" [1]
    OS:     Linux 2.6.32-042stab133.2 #1 SMP Mon Aug 27 21:07:08 MSK 2018 x86_64
    Shell:  /bin/bash
    PHP binary:     /usr/local/bin/php
    PHP version:    7.3.0
    php.ini used:   /usr/local/lib/php.ini
    WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
    WP-CLI vendor dir:      phar://wp-cli.phar/vendor
    WP_CLI phar path:       /usr/local/src/centminmod/addons
    WP-CLI packages dir:    /root/.wp-cli/packages/
    WP-CLI global config:
    WP-CLI project config:
    WP-CLI version: 2.1.0
    
    -------------------------------------------------------------
    wp-cli update completed
    Read http://wp-cli.org/ for full usage info
    -------------------------------------------------------------
    
    
    -------------------------------------------------------------
    Setup full Nginx vhost + Wordpress + WP Plugins
    -------------------------------------------------------------
    
    ---------------------------------------------------------------
    Important Information
    ---------------------------------------------------------------
    
    You are about to create an Wordpress based Nginx vhost site with
    or without HTTPS/SSL support.
    Also read the continually updated Getting Started Guide
    at centminmod.com/getstarted.html if you haven't already
    ---------------------------------------------------------------
    403 Permission denied message handling
    if after vhost site setup you encounter 403 permission denied errors,
    check https://community.centminmod.com/threads/11215/ to see if your
    site needs tools/autoprotect.sh tweaking & whitelisting
    ---------------------------------------------------------------
    [ LETSENCRYPT_DETECT is not enabled ]
    Ignore this message if you do not want HTTPS based web site otherwise
    read below carefully.
    
    Free letsencrypt SSL certificates integration is in beta testing if
    you want to obtain free letsencrypt SSL certificate for HTTPS site,
    you will need to manually enable LETSENCRYPT_DETECT='y' outlined
    at https://centminmod.com/acmetool so exit this vhost routine first
    set LETSENCRYPT_DETECT='y' and update domain DNS A record first
    then re-run vhost site creation menu option
    ---------------------------------------------------------------
    
    Do you want to continue with Nginx vhost site creation ? [y/n] y
    
    Enter vhost domain name you want to add (without www. prefix): demodomain.com
    
    Create a self-signed SSL certificate Nginx vhost? [y/n]: n
    Theme Setup:
    Install CyberChimps Responsive Theme (cyberchimps.com/responsive-theme/) [y/n]: n
    
    Wordpress Setup:
    Set custom WP Admin Display Name ? [y/n]: demodomain
    Install Wordpress in subdirectory /blog ? [y/n]: n
    Disable Auto Generated WP Admin Username / Password ? [y/n]: y
    Disable wp-login.php password protection ? (less security) [y/n]: y
    
    --------------------------
    !! Security Note !!
    --------------------------
    Please choose a stronger Username/Password Combination
    
    Enter desired WP Admin Username: demodomain
    Enter desired WP Admin Password:xxxxxxxxxxxx
    Enter email address for Admin User for Wordpress Installation: xxxxxxxxxxxx
    Default is to install KeyCDN WP Cache Enabler Plugin
    as it's more stable and reliable than WP Super Cache.
    Redis cache may have issues with caching due to long 6hr cache TTL
    You can select which caching method to use below:
    
    --------------------------------------------------------
            Wordpress Caching
    --------------------------------------------------------
    1). KeyCDN Cache Enabler (default & recommended)
    2). Redis Nginx Level Caching (may have issues with some wp plugins)
    3). Wordpress Super Cache
    --------------------------------------------------------
    Enter option [ 1 - 3 ] 1
    
    Create FTP username for vhost domain (enter username): demodomain
    Do you want to auto generate FTP password (recommended) [y/n]: y
    
    FTP username you entered: demodomain
    FTP password auto generated: xxxxxxxxx
    
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: NO)'
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
    Password:
    Enter it again:
    ------------------------------------------------------------
    Setup Wordpress + Cache Enabler for demodomain.com
    ------------------------------------------------------------
    
    Using full static page caching may cause problems for mobile & tablet device
    visitors depending on your WP themes used so you may want to exclude those
    
    Do you want to exclude mobile/tablet devices from Cache Enabler caching ? [y/n]: n
    Downloading WordPress 5.0.3 (en_US)...
    md5 hash verified: 83bec78836aabac08f769d50f1bffe5d
    Success: WordPress downloaded.
    ERROR 1045 (28000): Access denied for user 'wpdb8739u17582'@'localhost' (using password: YES)
    sed: can't read wp-config.php: No such file or directory
    sed: can't read wp-config.php: No such file or directory
    13 23 * * * /usr/local/src/centminmod/tools/autoprotect.sh >/dev/null 2>&1
    0 */4 * * * /usr/bin/cminfo_updater 2>/dev/null
    #*/15 * * * * sleep 206s ; wget -O - -q -t 1 http://demo.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    0 */8 * * * sleep 241s ;/root/tools/wp_updater_demo.com.sh >/dev/null 2>&1
    #*/15 * * * * sleep 226s ; wget -O - -q -t 1 http://demo.in/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    0 */8 * * * sleep 234s ;/root/tools/wp_updater_demo.in.sh >/dev/null 2>&1
    #*/15 * * * * sleep 318s ; wget -O - -q -t 1 http://demodomain.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    ------------------------------------------------------------
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    ------------------------------------------------------------
    configure cache-enabler
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    ------------------------------------------------------------
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    ------------------------------------------------------------
    ------------------------------------------------------------
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    ------------------------------------------------------------
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    ------------------------------------------------------------
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    ------------------------------------------------------------
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    
    Error: 'wp-config.php' not found.
    Either create one manually or use `wp config create`.
    ------------------------------------------------------------
    13 23 * * * /usr/local/src/centminmod/tools/autoprotect.sh >/dev/null 2>&1
    0 */4 * * * /usr/bin/cminfo_updater 2>/dev/null
    #*/15 * * * * sleep 206s ; wget -O - -q -t 1 http://demo2.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    0 */8 * * * sleep 241s ;/root/tools/wp_updater_demo2.com.sh >/dev/null 2>&1
    #*/15 * * * * sleep 226s ; wget -O - -q -t 1 http://demo1.in/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    0 */8 * * * sleep 234s ;/root/tools/wp_updater_demo1.in.sh >/dev/null 2>&1
    #*/15 * * * * sleep 318s ; wget -O - -q -t 1 http://demodomain.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    16 23 * * * echo "demodomain.com cacheenabler cron"; sleep 216s ; rm -rf /home/nginx/domains/demodomain.com/public/wp-content/cache/cache-enabler/* > /dev/null 2>&1
    ------------------------------------------------------------
    Created uninstall script
    /root/tools/wp_uninstall_demodomain.com.sh
    ------------------------------------------------------------
    ------------------------------------------------------------
    Created wp_updater_demodomain.com.sh script
    /root/tools/wp_updater_demodomain.com.sh
    ------------------------------------------------------------
    525
    52
    final 525
    final 52
    13 23 * * * /usr/local/src/centminmod/tools/autoprotect.sh >/dev/null 2>&1
    0 */4 * * * /usr/bin/cminfo_updater 2>/dev/null
    #*/15 * * * * sleep 206s ; wget -O - -q -t 1 http://demo.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    0 */8 * * * sleep 241s ;/root/tools/wp_updater_demo.com.sh >/dev/null 2>&1
    #*/15 * * * * sleep 226s ; wget -O - -q -t 1 http://demo.in/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    0 */8 * * * sleep 234s ;/root/tools/wp_updater_demo.in.sh >/dev/null 2>&1
    #*/15 * * * * sleep 318s ; wget -O - -q -t 1 http://demodomain.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    16 23 * * * echo "demodomain.com cacheenabler cron"; sleep 216s ; rm -rf /home/nginx/domains/demodomain.com/public/wp-content/cache/cache-enabler/* > /dev/null 2>&1
    0 */8 * * * sleep 525s ;/root/tools/wp_updater_demodomain.com.sh >/dev/null 2>&1
    
    -------------------------------------------------------------
    generated nginx include file [same]: /usr/local/nginx/conf/autoprotect/demo.com/autoprotect-demo3.com.conf
    generated nginx include file [diff]: /usr/local/nginx/conf/autoprotect/demo.com/autoprotect-demo2.com.conf
    generated nginx include file [same]: /usr/local/nginx/conf/autoprotect/demodomain.com/autoprotect-demodomain.com.conf
    generated nginx include file [initial]: /usr/local/nginx/conf/autoprotect/demodomain.com/autoprotect-demodomain.com.conf
    generated nginx include file [same]: /usr/local/nginx/conf/autoprotect/demo.com/autoprotect-demo1.com.conf
    generated nginx include file [same]: /usr/local/nginx/conf/autoprotect/demo.in/autoprotect-demo4.conf
    
    autoprotect.sh run completed skipped nginx reload...
    
    Reloading nginx configuration (via systemctl):  [  OK  ]
    service nginx reload
    Reloading nginx configuration (via systemctl):  [  OK  ]
    service php-fpm restart
    Gracefully shutting down php-fpm . done
    Starting php-fpm  done
    systemctl restart pure-ftpd.service
    
    -------------------------------------------------------------
    FTP hostname : 104.247.221.110
    FTP port : 21
    FTP mode : FTP (explicit SSL)
    FTP Passive (PASV) : ensure is checked/enabled
    FTP username created for demodomain.com : demodomain
    FTP password created for demodomain.com : 4p)-("Eeh4a:Pf28
    -------------------------------------------------------------
    vhost for demodomain.com created successfully
    
    domain: http://demodomain.com
    vhost conf file for demodomain.com created: /usr/local/nginx/conf/conf.d/demodomain.com.conf
    
    upload files to /home/nginx/domains/demodomain.com/public
    vhost log files directory is /home/nginx/domains/demodomain.com/log
    
    ------------------------------------------------------------
    SSH commands to uninstall created Wordpress install and Nginx vhost:
      /root/tools/wp_uninstall_demodomain.com.sh
    ------------------------------------------------------------
    
    ------------------------------------------------------------
    Wordpress Auto Updater created at:
      /root/tools/wp_updater_demodomain.com.sh
    cronjob set for every 8 hours update (3x times per day)
    ------------------------------------------------------------
    
    Wordpress domain: demodomain.com
    Wordpress DB Name: XXXXXXXXXXXX
    Wordpress DB User: XXXXXXXXXXXX
    Wordpress DB Pass: XXXXXXXXXXXX
    Wordpress Admin User ID: XXXXXXXXXXXX
    Wordpress Admin User: XXXXXXXXXXXX
    Wordpress Admin Pass: XXXXXXXXXXXX
    Wordpress Admin Email: XXXXXXXXXXXX
    Reloading nginx configuration (via systemctl):  [  OK  ]
    
    -------------------------------------------------------------
    Current vhost listing at: /usr/local/nginx/conf/conf.d/
    
    
    Dec 21  07:37   1.1K   demodomain.com.conf
    Dec 21  12:16   1.4K   virtual.conf
    Dec 21  13:54   4.3K   demo.com.ssl.conf
    Dec 21  15:41   4.2K   demo1.com.ssl.conf
    Dec 24  10:02   4.2K   demo2.com.ssl.conf
    Jan 2   09:58   2.3K   demo2.com.conf
    Jan 2   10:02   2.3K   demo1.com.conf
    Jan 2   10:03   2.2K   demo.com.conf
    Jan 18  13:45   4.0K   demo3.in.conf
    Jan 18  13:48   5.9K   demo3.in.ssl.conf
    Jan 19  03:08   3.9K   demodomain.com.conf
    
    ------------------------------------------------------------
    To complete setup:
      1. Enable Permalinks (DO NOT use links with .html extensions for performance reasons) i.e. /%post_id%/%postname%/
      2. Settings Menu > Cache Enabler set options and hit Save Changes (https://community.centminmod.com/threads/15039/)
      3. Settings Menu > Optimus set options and hit Save Changes
      4. Appearance > Theme Options (Responsive theme) > Home Page nav bar > Uncheck Overrides Wordpress front page option
    ------------------------------------------------------------
    
    -------------------------------------------------------------
    vhost for demodomain.com wordpress setup successfully
    demodomain.com setup info log saved at:
    /root/centminlogs/centminmod_123.09beta01.b089_190119-030152_demodomain.com_wordpress_addvhost.log
    
    
    I haven't changed the password or touched it ever. I couldnt find the .my.conf in my root folder.
    Code:
    mysqladmin version
    resulted
    Code:
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: NO)'
    

     
    Last edited: Jan 19, 2019
  2. eva2000

    eva2000 Administrator Staff Member

    41,380
    9,291
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,255
    Local Time:
    5:52 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    who is your web host and plan used ? OpenVZ ? KVM ?

    is mysql running ?

    can check with either these commands
    Code (Text):
    service mysqld status
    systemctl status mysql
    systemctl status mariadb
    

    if not running restart or start
    Code (Text):
    mysqlrestart
    mysqlstart
    

    or
    Code (Text):
    systemctl restart mysql
    systemctl restart mariadb
    


    then uninstall failed wordpress instance and try again centmin.sh menu option 22

    Every centmin.sh menu option 22 run has an accompanying uninstall script at /root/tools/wp_uninstall_${vhostname}.sh where ${vhostname} = your domain name. You can run that to uninstall almost everything except mysql database which you have to manually remove yourself - extra precaution in case you accidentally run the wrong uninstall script.
     
  3. pheonis

    pheonis Member

    51
    3
    8
    Dec 21, 2018
    Ratings:
    +4
    Local Time:
    1:22 PM
    The server is OpenVZ , mysql is up and running already.
    I cant uninstall the wordpress using centmin 22 menu. Its asking me if i want to create a new vhost, If i select "no". It comes to main menu
     
  4. pheonis

    pheonis Member

    51
    3
    8
    Dec 21, 2018
    Ratings:
    +4
    Local Time:
    1:22 PM
    Nevermind i successfully uninstalled the wordpress. and again getting the same error while retrying the wordpress installation
    Code:
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: NO)'
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
    while installing the wordpress. My mysql is running fine.
     
  5. eva2000

    eva2000 Administrator Staff Member

    41,380
    9,291
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,255
    Local Time:
    5:52 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    you should be able to use the uninstaller which is what you eventually did ?
    Looks like the mysql root password might not have been set properly. You can verify this by manually checking with command to check version
    Code (Text):
    mysqladmin -u root -p ver
    

    when prompted enter mysql root password that is set in /root/.my.cnf

    it should give you MariaDB MySQL server version 10.1.x something

    The auto generated mysql root password placed in /root/.my.cnf might contain characters in it that mysql server doesn't like.

    check if mysql root password created in install log is same as one in /root/.my.cnf
    Code (Text):
    grep -rn -B4 'MySQL root password:' /root/centminlogs/installer_*.log
    

    and
    Code (Text):
    cat /root/.my.cnf
    

    example output from install and install minimal logs
    Code (Text):
    grep -rn -B4 'MySQL root password:' /root/centminlogs/installer_*.log 
    /root/centminlogs/installer_170119-224222.log-17748--------------------------------------------------------
    /root/centminlogs/installer_170119-224222.log-17749-MySQL root user password set
    /root/centminlogs/installer_170119-224222.log-17750-MySQL root user added to /root/.my.cnf
    /root/centminlogs/installer_170119-224222.log-17751--------------------------------------------------------
    /root/centminlogs/installer_170119-224222.log:17752:MySQL root password: QO98KkhPEmqLPtP93DKC9bwo
    --
    /root/centminlogs/installer_170119-224222_minimal.log-12495--------------------------------------------------------
    /root/centminlogs/installer_170119-224222_minimal.log-12496-MySQL root user password set
    /root/centminlogs/installer_170119-224222_minimal.log-12497-MySQL root user added to /root/.my.cnf
    /root/centminlogs/installer_170119-224222_minimal.log-12498--------------------------------------------------------
    /root/centminlogs/installer_170119-224222_minimal.log:12499:MySQL root password: QO98KkhPEmqLPtP93DKC9bwo
    

    and /root/.my.cnf
    Code (Text):
    cat /root/.my.cnf   
    [client]
    user=root
    password=QO98KkhPEmqLPtP93DKC9bwo
    



     
  6. pheonis

    pheonis Member

    51
    3
    8
    Dec 21, 2018
    Ratings:
    +4
    Local Time:
    1:22 PM
    HI eva2000,
    The command
    Code:
    mysqladmin -u root -p ver
    asks me to enter the password. After i put the password, Here is the output.
    Code:
    mysqladmin  Ver 9.1 Distrib 10.1.37-MariaDB, for Linux on x86_64
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Server version          10.1.37-MariaDB
    Protocol version        10
    Connection              Localhost via UNIX socket
    UNIX socket             /var/lib/mysql/mysql.sock
    Uptime:                 1 day 7 hours 55 min 50 sec
    
    Threads: 1  Questions: 15940609  Slow queries: 0  Opens: 165  Flush tables: 1  Open tables: 159  Queries per second avg: 138.674
    
    Output of
    Code:
    grep -rn -B4 'MySQL root password:' /root/centminlogs/installer_*.log
    Code:
    grep: /root/centminlogs/installer_*.log: No such file or directory
    You have new mail in /var/spool/mail/root
    
    Output of
    Code:
    cat /root/.my.cnf
    Code:
    cat: /root/.my.cnf: No such file or directory
    I have already mentioned in the main post that .my.cnf is missing in the root folder.
     
  7. eva2000

    eva2000 Administrator Staff Member

    41,380
    9,291
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,255
    Local Time:
    5:52 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Ah that would be the problem.. usually that is set but for some reason it isn't for you.

    you can set it and create /root/.my.cnf with nano or vim linux text editor the following
    Code (Text):
    [client]
    user=root
    password=YOUR_MYSQL_ROOT_PASS
    

    Change YOUR_MYSQL_ROOT_PASS to your mysql root user password

    For nano which you can read up more about nano here and here. For vim text editor read here and here and thread at WebPerf - Popular Vim Commands – a Comprehensive Vim Cheatsheet

    Also there's numerous online how to use guides for nano and vim you can search for via google :)