在引导阶段进行或禁用mysql自动升级

在引导阶段进行或禁用mysql自动升级,mysql,Mysql,我发现mysql总是在启动阶段尝试自动升级: 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-0

我发现mysql总是在启动阶段尝试自动升级:

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.

我每次都会显示mysql在os引导阶段尝试采取的所有行动,mysql尝试升级但失败,现在轮到我解决问题了,哪一个是最好的--在引导阶段创建或禁用mysql自动升级?如何帮助mysql自动升级?

您最好的方法是让
root
用户使用
unix\u socket
身份验证进行打包,这样它就可以安全地进行更新

ALTER USER root@localhost IDENTIFIED VIA unix_socket
如果需要root用户,您可以作为unix root用户运行
mysql
,并进行身份验证。对于日常管理,创建您自己的用户

CREATE USER showkey@localhost IDENTIFIED VIA unix_socket
参考:

或使用密码:

CREATE USER showkey@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD('pwd') 
然后向该用户授予:

 GRANT ALL ON *.* TO showkey@localhost WITH GRANT OPTION

在我的电脑上尝试了这两种方法。 创建新用户是没有用的

CREATE USER showkey@localhost IDENTIFIED VIA unix_socket
GRANT ALL ON *.* TO showkey@localhost WITH GRANT OPTION
问题仍然存在,引导日志与以前相同,可能是因为在引导时使用root执行了自动升级脚本,它与新创建的用户
showkey

这是使mysql成为unix根用户并通过身份验证的正确方法

CREATE USER showkey@localhost IDENIFIED VIA unix_socket
重新启动我的电脑,然后检查引导日志

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

字符
T
CREATE USER中丢失showkey@localhost通过unix_套接字识别