mysql单机多实例Table 'mysql.user' doesn't exist

新手上路,请多包涵

日志:

[root@localhost ~]# cat /var/log/mysqld1.log
170909 07:20:45 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql1
2017-09-09 07:20:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-09-09 07:20:45 0 [Note] /usr/sbin/mysqld (mysqld 5.6.34) starting as process 3080 ...
2017-09-09 07:20:45 3080 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
2017-09-09 07:20:45 3080 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2017-09-09 07:20:45 3080 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-09-09 07:20:45 3080 [Note] InnoDB: The InnoDB memory heap is disabled
2017-09-09 07:20:45 3080 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-09-09 07:20:45 3080 [Note] InnoDB: Memory barrier is not used
2017-09-09 07:20:45 3080 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-09-09 07:20:45 3080 [Note] InnoDB: Using Linux native AIO
2017-09-09 07:20:45 3080 [Note] InnoDB: Using CPU crc32 instructions
2017-09-09 07:20:45 3080 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-09-09 07:20:45 3080 [Note] InnoDB: Completed initialization of buffer pool
2017-09-09 07:20:45 3080 [Note] InnoDB: Highest supported file format is Barracuda.
2017-09-09 07:20:45 3080 [Note] InnoDB: Log scan progressed past the checkpoint lsn 49463
2017-09-09 07:20:45 3080 [Note] InnoDB: Database was not shutdown normally!
2017-09-09 07:20:45 3080 [Note] InnoDB: Starting crash recovery.
2017-09-09 07:20:45 3080 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-09-09 07:20:45 3080 [Note] InnoDB: Restoring possible half-written data pages 
2017-09-09 07:20:45 3080 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1600607
2017-09-09 07:20:45 3080 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
InnoDB: Apply batch completed
2017-09-09 07:20:46 3080 [Note] InnoDB: 128 rollback segment(s) are active.
2017-09-09 07:20:46 3080 [Note] InnoDB: Waiting for purge to start
2017-09-09 07:20:46 3080 [Note] InnoDB: 5.6.34 started; log sequence number 1600607
2017-09-09 07:20:46 3080 [Note] Server hostname (bind-address): '*'; port: 3307
2017-09-09 07:20:46 3080 [Note] IPv6 is available.
2017-09-09 07:20:46 3080 [Note]   - '::' resolves to '::';
2017-09-09 07:20:46 3080 [Note] Server socket created on IP: '::'.
2017-09-09 07:20:46 3080 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
170909 07:20:46 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld1.pid ended
170909 07:21:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql1
2017-09-09 07:21:32 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-09-09 07:21:32 0 [Note] /usr/sbin/mysqld (mysqld 5.6.34) starting as process 3490 ...
2017-09-09 07:21:32 3490 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
2017-09-09 07:21:32 3490 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2017-09-09 07:21:32 3490 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-09-09 07:21:32 3490 [Note] InnoDB: The InnoDB memory heap is disabled
2017-09-09 07:21:32 3490 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-09-09 07:21:32 3490 [Note] InnoDB: Memory barrier is not used
2017-09-09 07:21:32 3490 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-09-09 07:21:32 3490 [Note] InnoDB: Using Linux native AIO
2017-09-09 07:21:32 3490 [Note] InnoDB: Using CPU crc32 instructions
2017-09-09 07:21:32 3490 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-09-09 07:21:32 3490 [Note] InnoDB: Completed initialization of buffer pool
2017-09-09 07:21:32 3490 [Note] InnoDB: Highest supported file format is Barracuda.
2017-09-09 07:21:32 3490 [Note] InnoDB: Log scan progressed past the checkpoint lsn 49463
2017-09-09 07:21:32 3490 [Note] InnoDB: Database was not shutdown normally!
2017-09-09 07:21:32 3490 [Note] InnoDB: Starting crash recovery.
2017-09-09 07:21:32 3490 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-09-09 07:21:32 3490 [Note] InnoDB: Restoring possible half-written data pages 
2017-09-09 07:21:32 3490 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1600607
2017-09-09 07:21:32 3490 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
InnoDB: Apply batch completed
2017-09-09 07:21:33 3490 [Note] InnoDB: 128 rollback segment(s) are active.
2017-09-09 07:21:33 3490 [Note] InnoDB: Waiting for purge to start
2017-09-09 07:21:33 3490 [Note] InnoDB: 5.6.34 started; log sequence number 1600607
2017-09-09 07:21:33 3490 [Note] Server hostname (bind-address): '*'; port: 3307
2017-09-09 07:21:33 3490 [Note] IPv6 is available.
2017-09-09 07:21:33 3490 [Note]   - '::' resolves to '::';
2017-09-09 07:21:33 3490 [Note] Server socket created on IP: '::'.
2017-09-09 07:21:33 3490 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
170909 07:21:33 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld1.pid ended

端口3306配置

[mysqld]
datadir=/var/lib/mysql0
socket=/var/lib/mysql0/mysql0.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
port=3306
server_id=0
[mysqld_safe]
log-error=/var/log/mysqld0.log
pid-file=/var/run/mysqld/mysqld0.pid

端口3307

[mysqld]
datadir=/var/lib/mysql1
socket=/var/lib/mysql1/mysql1.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
port=3307
server_id=1
[mysqld_safe]
log-error=/var/log/mysqld1.log
pid-file=/var/run/mysqld/mysqld1.pid

现象:

[root@localhost ~]# netstat -tnulp|grep 330
tcp        0      0 :::3306                     :::*                        LISTEN      2243/mysqld  

无法启动3307

阅读 5.7k
3 个回答
✓ 已被采纳新手上路,请多包涵

实在不好意思,初始化时候defaults拼错了,不知道为啥可以启动

先运行 mysql --initialize 再启动mysql试试看。

单机多实例有两种类型:

1、同一个appdir使用同一个配置文件配置多个示例,使用mysqld_multi配置启动
2、使用不同的appdir不同的config初始化不同的datadir

看你的情况是第二种吧?貌似你使用同一个appdir?还是说你根本就只装了一次rpm包,然后想初始化两个实例?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题