红联Linux门户
Linux帮助

MySQL安装启动时报错一则

发布时间:2016-06-03 10:07:37来源:linux网站作者:常飞梦

问题:

--成功安装
[root@hadoop0 rpm]# rpm -ivh MySQL-server-5.6.28-1.el6.x86_64.rpm
warning: MySQL-server-5.6.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ############################### [100%]
1:MySQL-server           ############################### [100%]


--但启动时报错
[root@hadoop0 rpm]# mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@hadoop0 rpm]# service mysql start
Starting MySQL..... ERROR! The server quit without updating PID file (/var/lib/mysql/hadoop0.pid).

[root@hadoop0 mysql]# cd /var/lib/mysql/
[root@hadoop0 mysql]# vi hadoop0.err
2016-05-16 14:11:01 3839 [Note] InnoDB: 128 rollback segment(s) are active.
2016-05-16 14:11:01 3839 [Note] InnoDB: Waiting for purge to start
2016-05-16 14:11:01 3839 [Note] InnoDB: 5.6.28 started; log sequence number 1600607
2016-05-16 14:11:01 3839 [Note] Server hostname (bind-address): '*'; port: 3306
2016-05-16 14:11:01 3839 [Note] IPv6 is available.
2016-05-16 14:11:01 3839 [Note]   - '::' resolves to '::';
2016-05-16 14:11:01 3839 [Note] Server socket created on IP: '::'.
2016-05-16 14:11:01 3839 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
160516 14:11:01 mysqld_safe mysqld from pid file /var/lib/mysql/hadoop0.pid ended


解决:初始化数据库
[root@hadoop0 ~]# mysql_install_db --user=mysql
Installing MySQL system tables...2016-05-16 14:22:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-05-16 14:22:45 0 [Note] /usr/sbin/mysqld (mysqld 5.6.28) starting as process 3906 ...
2016-05-16 14:22:45 3906 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-05-16 14:22:45 3906 [Note] InnoDB: The InnoDB memory heap is disabled
2016-05-16 14:22:45 3906 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-05-16 14:22:45 3906 [Note] InnoDB: Memory barrier is not used
2016-05-16 14:22:45 3906 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-05-16 14:22:45 3906 [Note] InnoDB: Using Linux native AIO
2016-05-16 14:22:45 3906 [Note] InnoDB: Using CPU crc32 instructions
2016-05-16 14:22:45 3906 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2016-05-16 14:22:45 3906 [Note] InnoDB: Completed initialization of buffer pool

MySQL安装启动时报错一则


登录正常
[root@hadoop0 ~]# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.28 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit
Bye


本文永久更新地址:http://www.linuxdiyf.com/linux/21193.html