您的位置:首页 > 数据库 > MySQL

MySQL安装-数据初始化操作时的问题处理

2015-11-04 16:52 796 查看
1、数据初始化-主机名解析错误

系统-Red Hat Enterprise Linux Server release 6.6

软件-源码安装mysql-5.6.27.tar.gz

环境-Linux rhel6.myexample.com 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

报错:WARNING

[root@rhel6 mysql]# scripts/mysql_install_db --user=mysql

WARNING: The host 'rhel6.myexample.com' could not be looked up with ./bin/resolveip.

This probably means that your libc libraries are not 100 % compatible

with this binary MySQL version. The MySQL daemon, mysqld, should work

normally with the exception that host name resolving will not work.

This means that you should use IP addresses instead of hostnames

when specifying MySQL privileges !

原因:主机名解析错误。

解决:hosts文件中添加如下内容,ok!

[root@rhel6 mysql]# vi /etc/hosts

192.168.56.20 rhel6.myexample.com

总结:

因为lib库不是很兼容当前MySQL版本。在主机名解析不起作用的情况下,会引起MySQL守护进程、mysqld工作异常,因此在MySQL中授权时需要使用IP地址,而不能使用主机名。

(不解决该问题,依然可以正确执行scripts/mysql_install_db数据库初始化脚本。)

2、数据初始化-时间戳问题

系统-Red Hat Enterprise Linux Server release 6.6

软件-源码安装mysql-5.6.27.tar.gz

环境-Linux rhel6.myexample.com 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

报错:Warning

[root@rhel6 mysql]# scripts/mysql_install_db --user=mysql

Installing MySQL system tables...2015-11-04 07:46:37 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-11-04 07:46:37 0 [Note] ./bin/mysqld (mysqld 5.6.27) starting as process 2867 ...

原因:机器的系统时间与TIMESTAMP时间戳不匹配。

解决:执行mysql_install_db数据初始化脚本时添加explicit_defaults_for_timestamp选项。

[root@rhel6 mysql]# scripts/mysql_install_db --user=mysql --explicit_defaults_for_timestamp

3、数据初始化-重复安装引起多个配置文件,默认配置文件

系统-Red Hat Enterprise Linux Server release 6.6

软件-源码安装mysql-5.6.27.tar.gz

环境-Linux rhel6.myexample.com 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

报错:Warning

WARNING: Found existing config file ./my.cnf on the system.

Because this file might be in use, it was not replaced,

but was used in bootstrap (unless you used --defaults-file)

and when you later start the server.

The new default config file was created as ./my-new.cnf,

please compare it with your file and take the changes you need.

WARNING: Default config file /etc/my.cnf exists on the system

This file will be read by default by the MySQL server

If you do not want to use this, either remove it, or use the

--defaults-file argument to mysqld_safe when starting the server
原因:

Warning1是因为重复安装,导致在安装目录下已经存在my.cnf文件。

Warning2是指默认的my.cnf配置文件在/etc/目录下。

启动Mysql server时,可指定--default-file=/path/my.cnf参数来启动mysql服务。

=============================================================================================================================

正确执行的显示:

[root@rhel6 mysql]# scripts/mysql_install_db --user=mysql --explicit_defaults_for_timestamp

Installing MySQL system tables...2015-11-04 08:48:03 0 [Note] ./bin/mysqld (mysqld 5.6.27) starting as process 3147 ...

2015-11-04 08:48:03 3147 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-11-04 08:48:03 3147 [Note] InnoDB: The InnoDB memory heap is disabled

2015-11-04 08:48:03 3147 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-11-04 08:48:03 3147 [Note] InnoDB: Memory barrier is not used

2015-11-04 08:48:03 3147 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-11-04 08:48:03 3147 [Note] InnoDB: Using CPU crc32 instructions

2015-11-04 08:48:03 3147 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-11-04 08:48:03 3147 [Note] InnoDB: Completed initialization of buffer pool

2015-11-04 08:48:03 3147 [Note] InnoDB: Highest supported file format is Barracuda.

2015-11-04 08:48:03 3147 [Note] InnoDB: 128 rollback segment(s) are active.

2015-11-04 08:48:03 3147 [Note] InnoDB: Waiting for purge to start

2015-11-04 08:48:03 3147 [Note] InnoDB: 5.6.27 started; log sequence number 1626007

2015-11-04 08:48:11 3147 [Note] Binlog end

2015-11-04 08:48:11 3147 [Note] InnoDB: FTS optimize thread exiting.

2015-11-04 08:48:11 3147 [Note] InnoDB: Starting shutdown...

2015-11-04 08:48:12 3147 [Note] InnoDB: Shutdown completed; log sequence number 1626017

OK

Filling help tables...2015-11-04 08:48:12 0 [Note] ./bin/mysqld (mysqld 5.6.27) starting as process 3171 ...

2015-11-04 08:48:12 3171 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-11-04 08:48:12 3171 [Note] InnoDB: The InnoDB memory heap is disabled

2015-11-04 08:48:12 3171 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-11-04 08:48:12 3171 [Note] InnoDB: Memory barrier is not used

2015-11-04 08:48:12 3171 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-11-04 08:48:12 3171 [Note] InnoDB: Using CPU crc32 instructions

2015-11-04 08:48:12 3171 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-11-04 08:48:12 3171 [Note] InnoDB: Completed initialization of buffer pool

2015-11-04 08:48:12 3171 [Note] InnoDB: Highest supported file format is Barracuda.

2015-11-04 08:48:12 3171 [Note] InnoDB: 128 rollback segment(s) are active.

2015-11-04 08:48:12 3171 [Note] InnoDB: Waiting for purge to start

2015-11-04 08:48:12 3171 [Note] InnoDB: 5.6.27 started; log sequence number 1626017

2015-11-04 08:48:12 3171 [Note] Binlog end

2015-11-04 08:48:12 3171 [Note] InnoDB: FTS optimize thread exiting.

2015-11-04 08:48:12 3171 [Note] InnoDB: Starting shutdown...

2015-11-04 08:48:14 3171 [Note] InnoDB: Shutdown completed; log sequence number 1626027

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 MySQL root USER !

To do so, start the server, then issue the following commands:

  ./bin/mysqladmin -u root password 'new-password'

  ./bin/mysqladmin -u root -h rhel6.myexample.com password 'new-password'

Alternatively you can run:

  ./bin/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 manual for more instructions.

You can start the MySQL daemon with:

  cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at

  http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as ./my.cnf and

will be used by default by the server when you start it.

You may edit this file to change server settings

WARNING: Default config file /etc/my.cnf exists on the system

This file will be read by default by the MySQL server

If you do not want to use this, either remove it, or use the

--defaults-file argument to mysqld_safe when starting the server

[root@rhel6 mysql]#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息