先装一个docker。
docker pull mysql
docker images
docker run -di --name xpy_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql
docker exec -it xpy_mysql /bin/bash
mysql -u -root -p
# docker 安装mysql navicate 需要对root localhost 访问赋权
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;
# mysql 8.0版本 更改密码
UPDATE mysql.user SET Password=PASSWORD('123456') WHERE User='root';
ALTER USER 'root'@'%' IDENTIFIED BY '123456';
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
# 创建表
create table enviroments( id int(32) primary key auto_increment, name varchar(32), ip varchar(32), host varchar(32), config mediumText, project_id int(11), status int(2), create_time datetime, update_time datetime, enviroment_desc text );
# 查看docker容器ID
docker ps -a
# docker 删除容器ID
docker rm 12345
docker start 12345
docker stop 12345
进入到mysql的命令行
网友评论