docker mysql 8.0

來源:互聯網
上載者:User

標籤:exe   mysql   name   save   art   ica   sel   nbsp   load   

Pull library/mysql$ docker pull mysqlLoad image$ docker load -i mysql.tarSave image$ docker save -o ~/Desktop/mysql.tar mysqlrun$ docker volume create --name mysql-data$ docker run -d -p 3306:3306 -v mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --restart=always --name=mysql mysql可以指定-e MYSQL_DATABASE=mytestdb來同時建立資料庫。如果是mysql伺服器版本大於8.0.4,預設使用caching_sha2_password授權外掛程式,而不是5.6/5.7使用的mysql_native_password進行身分識別驗證。下面方法更改root賬戶的遠程登入驗證外掛程式為mysql_native_password$ docker exec -it mysql mysql -uroot -p輸入123456進入mysql提示符ALTER USER ‘root‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘123456‘; FLUSH PRIVILEGES;SELECT User,Host,plugin FROM mysql.user;$ docker restart mysqlview logs$ docker logs -f mysqlstop/restart/start$ docker stop mysql$ docker restart mysql$ docker start mysql管理工具可以用Navicat Premium,資料庫伺服器用主機ip地址:3306,root密碼是MYSQL_ROOT_PASSWORD設定的密碼。匯出資料庫docker exec mysql sh -c ‘exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"‘ > ~/Desktop/all-databases.sql

 

docker mysql 8.0

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.