Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running mysql_upgrade in Docker?

Tags:

docker

mysql

I was trying to create a user using:

docker exec -i database mysql -uroot -proot -e "CREATE USER 'dbadmin'@'%'"

However I ran into this ERROR:

ERROR 1054 (42S22) at line 1: Unknown column 'password_last_changed' in 'mysql.user'
like image 331
Gus Avatar asked Dec 05 '16 19:12

Gus


People also ask

How do I run Mysql_upgrade?

On Windows, you must run mysql_upgrade with administrator privileges. You can do this by running a Command Prompt as Administrator and running the command. Failure to do so may result in the upgrade failing to execute correctly. You should always back up your current MySQL installation before performing an upgrade.

Can I use MySQL with Docker?

MySQL is one of the most popular SQL-compatible relational databases. Running MySQL inside a Docker container lets you separate your database from your code. You can also use a container orchestrator like Kubernetes to scale MySQL independently of your API server instance.


1 Answers

After googling for a few hours, I found the answer in this blog post:

docker exec -it container_name bash -c "mysql_upgrade -uroot -proot"

root must be your mysql username and password

like image 125
Gus Avatar answered Sep 20 '22 14:09

Gus