После новой установки mysql-server-8.0 для Kubuntu 19.10 я ввел mysql_secure_installation от командной строки. И следовал инструкциям.
Вот вывод моего процесса:
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Please set the password for root here.
New password:
Re-enter new password:
Estimated strength of the password: 0
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
Затем
da@n53sm:~$ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Я не мог понять что не так?
Вот вывод журнала ошибок:
da@n53sm:~$ tail -f /var/log/mysql/error.log
2020-01-21T07:27:02.077614Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18-0ubuntu0.19.10.1) (Ubuntu).
2020-01-21T07:27:03.414829Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18-0ubuntu0.19.10.1) starting as process 2774
2020-01-21T07:27:03.966655Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-01-21T07:27:03.973831Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory.
2020-01-21T07:27:04.010871Z 6 [System] [MY-013172] [Server] Received SHUTDOWN from user boot. Shutting down mysqld (Version: 8.0.18-0ubuntu0.19.10.1).
2020-01-21T07:27:04.994403Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18-0ubuntu0.19.10.1) (Ubuntu).
2020-01-21T07:27:09.363280Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18-0ubuntu0.19.10.1) starting as process 2939
2020-01-21T07:27:09.847387Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-01-21T07:27:09.872284Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.18-0ubuntu0.19.10.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu).
2020-01-21T07:27:10.013629Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
после перезапуска mysql журнал изменяется на это:
2020-01-21T07:49:41.567105Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18-0ubuntu0.19.10.1) (Ubuntu).
2020-01-21T07:49:41.941350Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18-0ubuntu0.19.10.1) starting as process 5006
2020-01-21T07:49:42.479793Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-01-21T07:49:42.501480Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.18-0ubuntu0.19.10.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu).
2020-01-21T07:49:42.591749Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
Ответ находится в Вашем выходном журнале.
Insecure configuration for --pid-file: Location '/tmp' in the path is accessible to all OS users. Consider choosing a different directory
Измените конфигурацию для MySQL для местоположения, чтобы быть равными папке в пользовательской папке (т.е. ~/tmp или/root/tmp).
Обратите внимание, что сигнал завершения работы получен после этого отказа. Это указывает, что вышеупомянутая функция была тем, что заставило MySQL закрываться.
Править: Я вижу, что MySQL жалуется на самоподписанный сертификат, и отказ инициализировать через SSL может быть первопричиной.
Обратитесь к этой ссылке от StackOverflow