Mysql.service: Referenced but unset environment variable evaluates to an empty string: MYSQLD_OPTS

New installed Ubuntu 24.04.3. When I install MySQL 8.4 (percona-server-server8.4.5-5-1.noble), I got error message failed to start:


mysql.service: Referenced but unset environment variable evaluates to an empty string: MYSQLD_OPTS

I check /usr/lib/systemd/system/mysql.service, it contain line like ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS. I compare with other MySQL distributed, usually the line like ExecStart=/usr/sbin/mysqld. Deleting `$MYSQLD_OPTS` from systemd unit file (and systemctl daemon-reload), give error, but with different messages, and the mysql error log like:

2025-08-12T08:22:48.838632Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2025-08-12T08:22:49.159932Z 0 [Warning] [MY-010097] [Server] Insecure configuration for --secure-log-path: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2025-08-12T08:22:49.160049Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.5-5) starting as process 2962
2025-08-12T08:22:49.168431Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-08-12T08:22:49.575827Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysqld: Table ‘mysql.plugin’ doesn’t exist
2025-08-12T08:22:49.998367Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2025-08-12T08:22:49.999006Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-08-12T08:22:49.999651Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-08-12T08:22:49.999942Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-08-12T08:22:50.000275Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-08-12T08:22:50.000535Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-08-12T08:22:50.000785Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-08-12T08:22:50.001038Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-08-12T08:22:50.075605Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2025-08-12T08:22:50.139407Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2025-08-12T08:22:50.151449Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2025-08-12T08:22:50.151504Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2025-08-12T08:22:50.156885Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2025-08-12T08:22:50.157195Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we’re sending the information to the error-log instead: MY-001146 - Table ‘mysql.component’ doesn’t exist
2025-08-12T08:22:50.157236Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we’re sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
2025-08-12T08:22:50.157422Z 0 [ERROR] [MY-000067] [Server] unknown variable ‘default-authentication-plugin=mysql_native_password’.
2025-08-12T08:22:50.158217Z 0 [ERROR] [MY-010119] [Server] Aborting
2025-08-12T08:22:51.717521Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.5-5) Percona Server (GPL), Release ‘5’, Revision ‘3d3abca6’.
2025-08-12T08:22:51.717547Z 0 [System] [MY-015016] [Server] MySQL Server - end.

Hi @gwijayas ,Welcome to Percona Community. If this is a fresh setup, I’d suggest you to just cleanup and redo fresh setup. Are you using old configuration file? may be you better adjust the auth plugin which is disabled by default… Thanks k

I haven’t installed MySQL, so I believe I don’t have my.cnf yet. As for auth plugin, on “option” when I run apt, during “Configuring percona-server-server”, I choose “Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)”

Ok, I try to reinstall again. I follow documentation at Use APT repositories - Percona Server for MySQL

# ls -alF /etc/mysql/
ls: cannot access '/etc/mysql/': No such file or directory
# percona-release enable-only ps-84-lts release
# percona-release enable tools release
# apt install percona-server-server
Errors were encountered while processing:
 percona-server-server
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
# tail /var/log/mysql/error.log
2025-08-13T03:42:00.292469Z 0 [ERROR] [MY-000067] [Server] unknown variable 'default-authentication-plugin=mysql_native_password'.
2025-08-13T03:42:00.292962Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2025-08-13T03:42:00.292975Z 0 [ERROR] [MY-010119] [Server] Aborting
2025-08-13T03:42:01.602625Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.

Only when reinstalled again and during “Configuring percona-server-server”, I choose “Use Strong Password Encryption(RECOMMENDED)”, the installation success. I hope, the option “Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)” not offered, if it will make installation failed

I don’t know to report bugs, since I can’t login on jira.percona.com, so I use this forum.https://docs.percona.com/percona-server/8.0/udf_percona_toolkit.html is not found. The link is show on installation using apt. I try https://docs.percona.com/percona-server/8.4/udf_percona_toolkit.html, just redirect to docs.percona.com.

Hello @gwijayas

As per the documentation,

Percona server disables by default the mysql-native-authentication.

If you want to use this, you can go into the configuration file and enable it by setting

mysql-native-password=ON

Most probably it should not prompt you to select though the mysql-native-password while installing.

Can you try setting the mysql-native-password to ON and then see if the service starts?

Hi @gwijayas ,

This surely looks like a bug. I verified and rerun the test in my machine and raised the bug report for you Jira.

You have to register to raise the bug, it is blogged here: https://www.percona.com/blog/report-bugs-improvements-new-feature-requests-for-percona-products

About the issue, removing / commenting the default authentication plugin in /etc/mysql/my.cnf and retrying installation works too. For now, what you have done using / providing secure password looks good way as well.

Thanks for raising this,

K.