apache容器远程mysql容器导入数据库(docker)
1.远程访问apache容器
2.因为centos7默认是安装mariadb,所以yum remove mariadb*
3.yum list installed mysql* mariadb*
4.wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
5.rpm -ivh mysql-community-release-el7-5.noarch.rpm 此时yum源中会有mysql的源
6.yum install mysql
7.find / -name mysqld 然后启动mysql
8.mysql -h ip -u user -p
9.source 路径(apache容器下的sql文件路径)
启动mysql服务期间可能遇到问题:
1.TIMESTAMP with implicit DEFAULT value is deprecated
解决办法:
在/etc/my.cnf 文件中的[mysqld]下添加一行explicit_defaults_for_timestamp=true。就可以了
2.Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
解决办法:
在/etc/my.cnf文件中,指定user=root;
3.Plugin 'FEDERATED' is disabled
解决办法:
没有初始化,执行/usr/bin/mysql_install_db --user=mysql