1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| docker pull ibex/debian-mysql-server-5.7 docker run --name skymysql -e MYSQL_ROOT_PASSWORD=root -d --restart unless-stopped -p 3306:3306 ibex/deb
# 进入docker root@050b1555fc9c:/# mysql -uroot -proot mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.26-1 (Debian)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE USER 'sky'@'%' IDENTIFIED BY 'root'; Query OK, 0 rows affected (0.01 sec)
mysql> create database swg default charset utf8 collate utf8_general_ci; Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on swg.* to 'sky'@'%' identified by 'root'; Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges; Query OK, 0 rows affected (0.01 sec)
mysql> use swg; Database changed
CREATE TABLE `rain` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `host` varchar(25) DEFAULT NULL, `rain` tinyint(1) unsigned DEFAULT NULL, `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `temper` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `temp` double DEFAULT NULL COMMENT '', `rh` double DEFAULT NULL COMMENT '', `host` varchar(25) DEFAULT NULL, `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.05 sec)
CREATE TABLE `wave` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `host` varchar(25) DEFAULT NULL, `distance` double DEFAULT NULL, `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=''; Query OK, 0 rows affected (0.05 sec)
mysql> exit # 设置docker 容器时间区域 root@050b1555fc9c:/# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime root@050b1555fc9c:/# date Mon Feb 24 20:07:14 CST 2020 # 重启 容器
|