docker version
docker pull mysql/mysql-server
docker run --name='sql_container' -d -p 3306:3306 mysql/mysql-server
docker logs sql_container
docker exec -it sql_container bash cd /var/lib/mysql mysql -u root -p ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
CREATE USER 'user'@'%' IDENTIFIED BY 'passwod'; GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;
host = localhost port = 3306 user_name = user user_password = password
The above is the detailed content of Running MySQL Server in Docker. For more information, please follow other related articles on the PHP Chinese website!