docker下修改mysql配置文件时vim未安装,安装镜像一直连接失败换国内也不行,故记录:
mv /etc/apt/sources.list /etc/apt/sources.list.bak //备份配置文件
//配置网易站点(好像失效了,失败)
echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" > /etc/apt/sources.list
echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list
echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
//另一个站点,也不行
echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" > /etc/apt/sources.list
echo "deb-src http://http.kali.org/kali kali-rolling main non-free contrib" >> /etc/apt/sources.list
解决:
环境:腾讯云主机CentOS
部署:Docker部署
进入Docker:docker exec -it 容器id bash
进入mysql:mysql -u root -p密码
//mysql -uroot -p密码
方法1:
查看Mysql时区:
mysql>show variables like ‘%time_zone%’;
(修改后,原本UTC 00:00)
设置为北京时间:
mysql> set time_zone='+8:00';
查看时间以验证:mysql> select now();
方法2:
可以通过修改my.cnf
在 [mysqld] 之下加
default-time-zone=timezone
来修改时区。如:
default-time-zone = ‘+8:00’
重启msyql容器(docker stop/satrt id
)