MariaDB10.x.x 初始化失败

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,高可用系列 2核4GB
云数据库 RDS PostgreSQL,高可用系列 2核4GB
简介: 背景mariadb在docker中运行,采用yum安装mariadb server的形式,然后使用mysql_install_db初始化的时指定my.cnf路径环境centos 7.4mariadb 10.

背景

mariadb在docker中运行,采用yum安装mariadb server的形式,然后使用mysql_install_db初始化的时指定my.cnf路径

环境

  • centos 7.4
  • mariadb 10.1.38

问题

[root@test /]# mysql_install_db --defaults-file=/etc/my.cnf --user=mysql
Neither host 'test' nor 'localhost' could be looked up with
'/usr/sbin/resolveip'
Please configure the 'hostname' command to return a correct
hostname.
If you want to solve this at a later stage, restart this script
with the --force option

The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db

[root@test /]# cat /etc/hosts 
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.3 test

[root@test /]# mysql_install_db --defaults-file=/etc/my.cnf --user=mysql --datadir=/var/lib/mysql/data/mydata/
Neither host 'test' nor 'localhost' could be looked up with
'/usr/sbin/resolveip'
Please configure the 'hostname' command to return a correct
hostname.
If you want to solve this at a later stage, restart this script
with the --force option

The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db

[root@test /]# cat /etc/hosts 
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.3 test

[root@test /]# mysql_install_db --defaults-file=/etc/my.cnf --user=mysql
Neither host 'test' nor 'localhost' could be looked up with
'/usr/sbin/resolveip'
Please configure the 'hostname' command to return a correct
hostname.
If you want to solve this at a later stage, restart this script
with the --force option

The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db

[root@test /]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.3 test

解决方式

[root@test /]# mysql_install_db --defaults-file=/etc/my.cnf --user=mysql --force
Installing MariaDB/MySQL system tables in '/var/lib/mysql/data/mydata' ...
2019-02-15 12:57:08 140419367405824 [Warning] 'table-open-cache-instances' is MySQL 5.6 compatible option. Not used or needed in MariaDB.
2019-02-15 12:57:08 140419367405824 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB) starting as process 610 ...
OK
Filling help tables...
2019-02-15 12:57:58 140283421616384 [Warning] 'table-open-cache-instances' is MySQL 5.6 compatible option. Not used or needed in MariaDB.
2019-02-15 12:57:58 140283421616384 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB) starting as process 659 ...
OK
Creating OpenGIS required SP-s...
2019-02-15 12:58:04 140430938585344 [Warning] 'table-open-cache-instances' is MySQL 5.6 compatible option. Not used or needed in MariaDB.
2019-02-15 12:58:04 140430938585344 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB) starting as process 710 ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/usr/sbin/mysqladmin' -u root password 'new-password'
'/usr/sbin/mysqladmin' -u root -h password 'new-password'

Alternatively you can run:
'/usr/sbin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/usr' ; /usr/sbin/mysqld_safe --datadir='/var/lib/mysql/data/mydata'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

参数解析

[root@test /]# mysql_install_db --help
...
  --force              Causes mysql_install_db to run even if DNS does not work. In that case, grant table entries that normally use hostnames will use IP addresses.
...
  • 当无法使用DNS解析时,使用--force参数来强制使用ip进行初始化
相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。   相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情: https://www.aliyun.com/product/rds/mysql 
目录
相关文章
|
开发工具
【开发工具】赋予 webstorm terminal 管理员权限
【开发工具】赋予 webstorm terminal 管理员权限
833 1
|
Docker 容器
docker容器时差8小时
docker容器时差8小时
532 3
|
Java Nacos
在MSE微服务引擎中,可以使用Java代码进行Nacos下线操作
在MSE微服务引擎中,可以使用Java代码进行Nacos下线操作
357 3
|
Web App开发 JavaScript Java
浏览器同域名请求的最大并发数限制
  当我们在浏览网页的时候,对浏览速度有一个重要的影响因素,就是浏览器的并发数量。并发数量简单通俗的讲就是,当浏览器网页的时候同时工作的进行数量。   如果同时只有2个并发连接数数量,那网页打开的时候只能依赖于这2条线程,前面如果有打开慢的内容,就会直接影响到后面的内容打开。
6779 0
|
6月前
|
机器学习/深度学习 分布式计算 Kubernetes
30分钟拉起Ray集群并部署Stable Diffusion模型服务
Ray 是一个支持模型训练、测试以及部署的开源平台,由加州大学伯克利分校的 RISELab 开发。它旨在简化大规模机器学习、强化学习和分布式计算任务的开发与部署。阿里云计算巢实现了Ray Cluster的一键部署,帮助用户能够便捷地使用分布式集群训练和测试自己的模型。
|
关系型数据库 MySQL Linux
在Linux中,如何启动、停止、重启一个系统服务?
在Linux中,如何启动、停止、重启一个系统服务?
|
应用服务中间件 Docker 容器
docker tomcat时间少8小时问题解决
通过这些步骤,你应该能够解决Docker容器中Tomcat时间少8小时的问题,并确保容器中的时间与主机系统的时间保持一致。请根据你的实际情况和时区要求来调整时区设置。
371 0
|
JavaScript 前端开发
vue前端获取本地IP地址
vue前端获取本地IP地址
|
Ubuntu Java Linux
Pcap4J抓包
学习使用pacp4j
1028 0