skip to Main Content

I find that mysql always try to auto-upgrade in the booting stage:

sudo journalctl -b -l | grep  mysql
Feb 04 13:05:35 mydebian mysqld[713]: 2021-02-04 13:05:35 0 [Note] /usr/sbin/mysqld (mysqld 10.3.27-MariaDB-0+deb10u1) starting as process 713 ...
Feb 04 13:05:35 mydebian mysqld[713]: 2021-02-04 13:05:35 0 [Warning] Could not increase number of max_open_files to more than 16384 (request: 32184)
Feb 04 13:05:41 mydebian /etc/mysql/debian-start[822]: Upgrading MySQL tables if necessary.
Feb 04 13:05:42 mydebian /etc/mysql/debian-start[826]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
Feb 04 13:05:42 mydebian /etc/mysql/debian-start[826]: Looking for 'mysql' as: /usr/bin/mysql
Feb 04 13:05:42 mydebian /etc/mysql/debian-start[826]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Feb 04 13:05:42 mydebian /etc/mysql/debian-start[826]: Version check failed. Got the following error when calling the 'mysql' command line client
Feb 04 13:05:42 mydebian /etc/mysql/debian-start[826]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Feb 04 13:05:42 mydebian /etc/mysql/debian-start[826]: FATAL ERROR: Upgrade failed
Feb 04 13:05:42 mydebian /etc/mysql/debian-start[837]: Checking for insecure root accounts.

I display all action mysql try to take during os booting stage everytime,mysql try to upgrade but failed .It is my turn to solve the issue,which is the best–make or disable mysql auto upgrade in the booting stage?How to help mysql auto-upgrade then?

2

Answers


  1. Chosen as BEST ANSWER

    Having tried the two methods in my pc. It is no use to create a new user.

    CREATE USER showkey@localhost IDENTIFIED VIA unix_socket
    GRANT ALL ON *.* TO showkey@localhost WITH GRANT OPTION
    

    Issue remains ,booting log is the same as before,maybe the reason is that auto upgrade script executed with root at the booting,it is no related with new created user showkey.
    It is the proper way to make the mysql as the unix root user and be authenticated with

    CREATE USER showkey@localhost IDENIFIED VIA unix_socket
    

    Reboot my pc then check the booting log.

    sudo journalctl -b |grep   mysql
    Feb 04 17:54:39 mydebian mysqld[690]: 2021-02-04 17:54:39 0 [Note] /usr/sbin/mysqld (mysqld 10.3.27-MariaDB-0+deb10u1) starting as process 690 ...
    Feb 04 17:54:39 mydebian mysqld[690]: 2021-02-04 17:54:39 0 [Warning] Could not increase number of max_open_files to more than 16384 (request: 32184)
    Feb 04 17:54:44 mydebian /etc/mysql/debian-start[792]: Upgrading MySQL tables if necessary.
    Feb 04 17:54:46 mydebian /etc/mysql/debian-start[796]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
    Feb 04 17:54:46 mydebian /etc/mysql/debian-start[796]: Looking for 'mysql' as: /usr/bin/mysql
    Feb 04 17:54:46 mydebian /etc/mysql/debian-start[796]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
    Feb 04 17:54:46 mydebian /etc/mysql/debian-start[796]: This installation of MySQL is already upgraded to 10.3.27-MariaDB, use --force if you still need to run mysql_upgrade
    Feb 04 17:54:46 mydebian /etc/mysql/debian-start[805]: Checking for insecure root accounts.
    Feb 04 17:54:46 mydebian /etc/mysql/debian-start[809]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables
    

  2. Your best approach is to leave the root user for packaging with unix_socket authentication so it can be secure be able to do updates.

    ALTER USER root@localhost IDENTIFIED VIA unix_socket
    

    If you need root you can run mysql as the unix root user and be authenticated. For day-to-day admin, create your own user.

    CREATE USER showkey@localhost IDENTIFIED VIA unix_socket
    

    ref: Authentication unix socket

    Or with a password:

    CREATE USER showkey@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD('pwd') 
    

    And then give that user grants:

     GRANT ALL ON *.* TO showkey@localhost WITH GRANT OPTION
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search