docker search mysql/mysql-server (这是一个优化过的镜像)
docker run -d -p 3306:3306 --name 1mysql mysql/mysql-server
docker logs 1mysql
这里可以看到默认密码: ALYr7atHubRyNHoBAcArjefTIP[
docker exec -it 1mysql bash
mysql -uroot -p
输入默认密码,默认密码是隐藏的,不要以为复制不了
修改密码的语句:
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; 记住后面的;不要忘记了
create user 'wkai'@'localhost' identified by '123456';
CREATE USER 'wkai'@'%' IDENTIFIED BY '123456'; %指的是任意地方都能访问
GRANT ALL PRIVILEGES ON *.* TO 'wkai'@'%'
WITH GRANT OPTION;
在[mysqld]下添加以下代码
character-set-server=utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8