1、mysql5.7:
1)vim /etc/my.cnf 最后加入skip-grant-tables
2)重启MySQL, /etc/init.d/mysqld restart
3)终端输入 mysql 直接登录MySQL数据库,然后use mysql
4)update mysql.user set authentication_string=password('root') where user='root' ;
5)编辑my.cnf文件删掉skip-grant-tables 这一行,然后重启MySQL,/etc/init.d/mysqld restart,否则MySQL仍能免密码登录
6)mysql5.7更改密码应该采用命令 ALTER USER 'root'@'localhost'IDENTIFIED BY '********'其中密码的命名规则有所改变,详见
http://blog.csdn.net/u010603691/article/details/50541979
7)授权远程登录:
1. )GRANT ALL PRIVILEGES ON *.* TO '*.*'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 2.)FLUSH PRIVILEGES;
docker mac
#mysql docker ps docker stop pid docder container rm pid
sudo docker exec -it f165741cb5b6 /bin/bash
docker run --name mysql -p 3306:3306 -p 33060:33060 -v /Users/username/logs/docker/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql:latest #mongo docker run --name mongo -p 27017:27017 -v /Users/wangmin/logs/docker/mongo:/etc/mongo -v /Users/wangmin/logs/docker/mongo/data/db:/data/db -v /Users/wangmin/logs/docker/mongo/data/configdb:/data/configdb -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=root -d mongo:latest
#zookeeper
docker run --name my-zookeeper -p 2181:2181 -v /Users/wangmin/logs/docker/zookeeper/data:/data -v /Users/wangmin/logs/docker/zookeeper/datalog:/datalog -v /Users/wangmin/logs/docker/zookeeper/logs:/logs --restart always -e ZOO_LOG4J_PROP="INFO,ROLLINGFILE" -d zookeeper:latest