mysqlbashubuntu

mysql_tzinfo_to_sql - access denied


I am running MySQL 8.0.36 on Ubuntu 22.04.4 LTS.

I am trying to run this command on Ubuntu bash:

mysql_tzinfo_to_sql /usr/share/zoneinfo

But I always get an access denied error. Here is what I've tried, and the different types of permissions errors I got:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p'myShellRootPWD' mysql

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p'myMySQLRootPWD' mysql

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

(enter password at prompt)

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I am logged into bash as root. When supplying passwords to the above commands, I have tried both my MySQL root password and my SSH root password. Obviously my SSH root password is correct because I'm logged into SSH/bash as root. I know that my MySQL root password is correct because I can successfully log into the MySQL terminal (as root) and run queries.

I verified that /usr/share/zoneinfo is a valid directory on my OS. How can the all powerful root user not have access to do something?? What am I doing wrong?


Solution

  • Solved! I had to run it like this:

    mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p***** -h 127.0.0.1 mysql