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进行初始化
相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
关系型数据库 MySQL 数据安全/隐私保护
【已解决】mysql8.0.x 初始化root密码(错误:1251、ERROR 1064)
mysql8.0.x 初始化root密码(错误:1251、ERROR 1064)
503 0
【已解决】mysql8.0.x 初始化root密码(错误:1251、ERROR 1064)
|
关系型数据库 MySQL
MySql提示服务已经启动成功但又提示can’t connect to MySQL server解决方法,mysql服务自动停止处理方法
MySql提示服务已经启动成功但又提示can’t connect to MySQL server解决方法,mysql服务自动停止处理方法
317 0
MySql提示服务已经启动成功但又提示can’t connect to MySQL server解决方法,mysql服务自动停止处理方法
|
关系型数据库 MySQL 数据安全/隐私保护
mysql 5.7 初始化问题---空密码
1819 Your password does not satisfy the current policy requirements
4702 0
|
关系型数据库 MySQL
|
关系型数据库 MySQL 监控
|
关系型数据库 MySQL
|
缓存 关系型数据库 MySQL
|
关系型数据库 MySQL