这个问题开始于所以,有人建议最好在这里提问:
我正在尝试手动在 vagrant box(Ubuntu 16)上安装 mysql。这是我的Vagrantfile
Vagrant.configure("2") do |config|
config.vm.define :mgmt do |mgmt_config|
mgmt_config.vm.box = "ubuntu/trusty64"
mgmt_config.vm.hostname = "mgmt"
mgmt_config.vm.network :private_network, ip: "10.0.15.10"
mgmt_config.vm.provider "virtualbox" do |vb|
vb.memory = "256"
end
mgmt_config.vm.provision :shell, path: "bootstrap-mgmt.sh"
end
config.vm.define :node do |node|
node.vm.box = "ubuntu/trusty64"
node.vm.hostname = "web1"
node.vm.network :private_network, ip: "10.0.15.11"
node.vm.network "forwarded_port", guest: 80, host: 8080
node.vm.provider "virtualbox" do |vb|
vb.memory = "256"
end
end
end
输出如下:
ubuntu@web1:~$ sudo apt-get update # runs fine
ubuntu@web1:~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl
libevent-core-2.0-5 libfcgi-perl libhtml-parser-perl
libhtml-tagset-perl libhtml-template-perl libhttp-date-perl
libhttp-message-perl libio-html-perl liblwp-mediatypes-perl
libtimedate-perl liburi-perl mysql-client-5.7
mysql-client-core-5.7 mysql-common mysql-server-5.7
mysql-server-core-5.7
Suggested packages:
libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx
tinyca
The following NEW packages will be installed:
libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl
libevent-core-2.0-5 libfcgi-perl libhtml-parser-perl
libhtml-tagset-perl libhtml-template-perl libhttp-date-perl
libhttp-message-perl libio-html-perl liblwp-mediatypes-perl
libtimedate-perl liburi-perl mysql-client-5.7
mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7
mysql-server-core-5.7
0 upgraded, 21 newly installed, 0 to remove and 7 not upgraded.
Need to get 19.4 MB of archives.
After this operation, 163 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libevent-core-2.0-5 amd64 2.0.21-stable-2 [69.4 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-common all 5.7.17-0ubuntu0.16.04.1 [15.1 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 libaio1 amd64 0.3.110-2 [6,356 B]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client-core-5.7 amd64 5.7.17-0ubuntu0.16.04.1 [6,325 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client-5.7 amd64 5.7.17-0ubuntu0.16.04.1 [1,762 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server-core-5.7 amd64 5.7.17-0ubuntu0.16.04.1 [7,728 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server-5.7 amd64 5.7.17-0ubuntu0.16.04.1 [2,856 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 libhtml-tagset-perl all 3.20-2 [13.5 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/main amd64 liburi-perl all 1.71-1 [76.9 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 libhtml-parser-perl amd64 3.72-1 [86.1 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial/main amd64 libcgi-pm-perl all 4.26-1 [185 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial/main amd64 libfcgi-perl amd64 0.77-1build1 [32.3 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial/main amd64 libcgi-fast-perl all 1:2.10-1 [10.2 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial/main amd64 libencode-locale-perl all 1.05-1 [12.3 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial/main amd64 libhtml-template-perl all 2.95-2 [60.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial/main amd64 libtimedate-perl all 2.3000-2 [37.5 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial/main amd64 libhttp-date-perl all 6.02-1 [10.4 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial/main amd64 libio-html-perl all 1.001-1 [14.9 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial/main amd64 liblwp-mediatypes-perl all 6.02-1 [21.7 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial/main amd64 libhttp-message-perl all 6.11-1 [74.3 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server all 5.7.17-0ubuntu0.16.04.1 [10.1 kB]
Fetched 19.4 MB in 29s (668 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libevent-core-2.0-5:amd64.
(Reading database ... 53815 files and directories currently installed.)
Preparing to unpack .../libevent-core-2.0-5_2.0.21-stable-2_amd64.deb ...
Unpacking libevent-core-2.0-5:amd64 (2.0.21-stable-2) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../mysql-common_5.7.17-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-common (5.7.17-0ubuntu0.16.04.1) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../libaio1_0.3.110-2_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-2) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../mysql-client-core-5.7_5.7.17-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.17-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.17-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.17-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../mysql-server-core-5.7_5.7.17-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.17-0ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-common (5.7.17-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 53984 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.17-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.17-0ubuntu0.16.04.1) ...
Selecting previously unselected package libhtml-tagset-perl.
Preparing to unpack .../libhtml-tagset-perl_3.20-2_all.deb ...
Unpacking libhtml-tagset-perl (3.20-2) ...
Selecting previously unselected package liburi-perl.
Preparing to unpack .../liburi-perl_1.71-1_all.deb ...
Unpacking liburi-perl (1.71-1) ...
Selecting previously unselected package libhtml-parser-perl.
Preparing to unpack .../libhtml-parser-perl_3.72-1_amd64.deb ...
Unpacking libhtml-parser-perl (3.72-1) ...
Selecting previously unselected package libcgi-pm-perl.
Preparing to unpack .../libcgi-pm-perl_4.26-1_all.deb ...
Unpacking libcgi-pm-perl (4.26-1) ...
Selecting previously unselected package libfcgi-perl.
Preparing to unpack .../libfcgi-perl_0.77-1build1_amd64.deb ...
Unpacking libfcgi-perl (0.77-1build1) ...
Selecting previously unselected package libcgi-fast-perl.
Preparing to unpack .../libcgi-fast-perl_1%3a2.10-1_all.deb ...
Unpacking libcgi-fast-perl (1:2.10-1) ...
Selecting previously unselected package libencode-locale-perl.
Preparing to unpack .../libencode-locale-perl_1.05-1_all.deb ...
Unpacking libencode-locale-perl (1.05-1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../libhtml-template-perl_2.95-2_all.deb ...
Unpacking libhtml-template-perl (2.95-2) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../libtimedate-perl_2.3000-2_all.deb ...
Unpacking libtimedate-perl (2.3000-2) ...
Selecting previously unselected package libhttp-date-perl.
Preparing to unpack .../libhttp-date-perl_6.02-1_all.deb ...
Unpacking libhttp-date-perl (6.02-1) ...
Selecting previously unselected package libio-html-perl.
Preparing to unpack .../libio-html-perl_1.001-1_all.deb ...
Unpacking libio-html-perl (1.001-1) ...
Selecting previously unselected package liblwp-mediatypes-perl.
Preparing to unpack .../liblwp-mediatypes-perl_6.02-1_all.deb ...
Unpacking liblwp-mediatypes-perl (6.02-1) ...
Selecting previously unselected package libhttp-message-perl.
Preparing to unpack .../libhttp-message-perl_6.11-1_all.deb ...
Unpacking libhttp-message-perl (6.11-1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.17-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-server (5.7.17-0ubuntu0.16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu16) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up libevent-core-2.0-5:amd64 (2.0.21-stable-2) ...
Setting up libaio1:amd64 (0.3.110-2) ...
Setting up mysql-client-core-5.7 (5.7.17-0ubuntu0.16.04.1) ...
Setting up mysql-client-5.7 (5.7.17-0ubuntu0.16.04.1) ...
Setting up mysql-server-core-5.7 (5.7.17-0ubuntu0.16.04.1) ...
Setting up mysql-server-5.7 (5.7.17-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up libhtml-tagset-perl (3.20-2) ...
Setting up liburi-perl (1.71-1) ...
Setting up libhtml-parser-perl (3.72-1) ...
Setting up libcgi-pm-perl (4.26-1) ...
Setting up libfcgi-perl (0.77-1build1) ...
Setting up libcgi-fast-perl (1:2.10-1) ...
Setting up libencode-locale-perl (1.05-1) ...
Setting up libhtml-template-perl (2.95-2) ...
Setting up libtimedate-perl (2.3000-2) ...
Setting up libhttp-date-perl (6.02-1) ...
Setting up libio-html-perl (1.001-1) ...
Setting up liblwp-mediatypes-perl (6.02-1) ...
Setting up libhttp-message-perl (6.11-1) ...
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.23-0ubuntu5) ...
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for systemd (229-4ubuntu16) ...
Failed to execute operation: Connection timed out
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
基本上,系统提示我输入 root 密码,然后出现上述错误。
另外,如果你好奇的话:
ubuntu@web1:~$ sudo service mysql status
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendo
Active: activating (start-post) (Result: exit-code) since Mon 201
Process: 5711 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FA
Process: 5707 ExecStartPre=/usr/share/mysql/mysql-systemd-start pr
Main PID: 5711 (code=exited, status=1/FAILURE); : 5712 (mys
Tasks: 2
Memory: 1.1M
CPU: 176ms
CGroup: /system.slice/mysql.service
└─control
├─5712 /bin/bash /usr/share/mysql/mysql-systemd-start p
└─5718 sleep 1
Feb 20 13:02:52 web1 systemd[1]: Starting MySQL Community Server...
Feb 20 13:02:52 web1 systemd[1]: mysql.service: Main process exited,
ubuntu@web1:~$ sudo service mysql start
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
我究竟做错了什么?
编辑:
以下是一些可能相关的信息:
ubuntu@web1:~$ systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
Active: activating (start-post) (Result: exit-code) since Mon 2017-02-20 13:3
Process: 9643 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 9640 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exit
Main PID: 9643 (code=exited, status=1/FAILURE); : 9644 (mysql-systemd-s
Tasks: 2
Memory: 308.0K
CPU: 218ms
CGroup: /system.slice/mysql.service
└─control
├─9644 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─9727 sleep 1
Feb 20 13:30:20 web1 systemd[1]: Starting MySQL Community Server...
Feb 20 13:30:20 web1 systemd[1]: mysql.service: Main process exited, code=exited
ubuntu@web1:~$ journalctl -xe
-- The result is failed.
Feb 20 13:31:21 web1 systemd[1]: mysql.service: Unit entered failed state.
Feb 20 13:31:21 web1 systemd[1]: mysql.service: Failed with result 'exit-code'.
Feb 20 13:31:21 web1 systemd[1]: mysql.service: Service hold-off time over, sche
Feb 20 13:31:21 web1 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Feb 20 13:31:21 web1 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Feb 20 13:31:21 web1 audit[9840]: AVC apparmor="DENIED" operation="open" profile
Feb 20 13:31:21 web1 audit[9840]: AVC apparmor="DENIED" operation="open" profile
Feb 20 13:31:21 web1 audit[9840]: AVC apparmor="DENIED" operation="open" profile
Feb 20 13:31:21 web1 kernel: audit: type=1400 audit(1487597481.919:268): apparmo
Feb 20 13:31:21 web1 kernel: audit: type=1400 audit(1487597481.919:269): apparmo
Feb 20 13:31:21 web1 kernel: audit: type=1400 audit(1487597481.919:270): apparmo
Feb 20 13:31:22 web1 systemd[1]: mysql.service: Main process exited, code=exited
ubuntu@web1:~$ sudo dpkg --configure -a
Setting up mysql-server-5.7 (5.7.17-0ubuntu0.16.04.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.7
mysql-server
编辑2:
根据答案这里我编辑/etc/mysql/mysql.conf.d/mysqld.cnf
注释掉,key_buffer_size = 16M
但仍然失败myisam-recover-options = BACKUP
sudo service mysql start
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
以下是详细信息:
ubuntu@web1:/etc/mysql/mysql.conf.d$ systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
Active: activating (start-post) (Result: exit-code) since Tue 2017-02-21 11:4
Process: 5900 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 5897 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exit
Main PID: 5900 (code=exited, status=1/FAILURE); : 5901 (mysql-systemd-s
Tasks: 2
Memory: 1.1M
CPU: 203ms
CGroup: /system.slice/mysql.service
└─control
├─5901 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─5927 sleep 1
Feb 21 11:42:59 web1 systemd[1]: Starting MySQL Community Server...
Feb 21 11:42:59 web1 systemd[1]: mysql.service: Main process exited, code=exited
ubuntu@web1:/etc/mysql/mysql.conf.d$ journalctl -xe
-- The result is failed.
Feb 21 11:43:29 web1 systemd[1]: mysql.service: Unit entered failed state.
Feb 21 11:43:29 web1 systemd[1]: mysql.service: Failed with result 'exit-code'.
Feb 21 11:43:29 web1 systemd[1]: mysql.service: Service hold-off time over, sche
Feb 21 11:43:29 web1 systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Feb 21 11:43:29 web1 systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Feb 21 11:43:29 web1 audit[5974]: AVC apparmor="DENIED" operation="open" profile
Feb 21 11:43:29 web1 audit[5974]: AVC apparmor="DENIED" operation="open" profile
Feb 21 11:43:29 web1 audit[5974]: AVC apparmor="DENIED" operation="open" profile
Feb 21 11:43:29 web1 kernel: audit: type=1400 audit(1487677409.642:117): apparmo
Feb 21 11:43:29 web1 kernel: audit: type=1400 audit(1487677409.642:118): apparmo
Feb 21 11:43:29 web1 kernel: audit: type=1400 audit(1487677409.642:119): apparmo
Feb 21 11:43:29 web1 systemd[1]: mysql.service: Main process exited, code=exited
编辑3:
这是错误日志
ubuntu@web1:/var/log/mysql$ cat error.log
2017-02-21T22:20:56.386645Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-02-21T22:20:57.036924Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-02-21T22:20:57.257518Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-02-21T22:20:57.509378Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 046e600d-f884-11e6-8c0f-0284084ffd23.
2017-02-21T22:20:57.510247Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-02-21T22:20:57.530171Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2017-02-21T22:21:02.701191Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-02-21T22:21:02.701278Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-02-21T22:21:02.894719Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-02-21T22:21:02.903558Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.17-0ubuntu0.16.04.1) starting as process 3467 ...
2017-02-21T22:21:02.929008Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-02-21T22:21:02.929041Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-02-21T22:21:02.929047Z 0 [Note] InnoDB: Uses event mutexes
2017-02-21T22:21:02.929052Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-02-21T22:21:02.929058Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-02-21T22:21:02.929063Z 0 [Note] InnoDB: Using Linux native AIO
2017-02-21T22:21:02.929256Z 0 [Note] InnoDB: Number of pools: 1
2017-02-21T22:21:02.929344Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-02-21T22:21:02.930541Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-02-21T22:21:02.930674Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2017-02-21T22:21:02.930698Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2017-02-21T22:21:02.930710Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-02-21T22:21:02.930723Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-02-21T22:21:02.930773Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-02-21T22:21:02.930784Z 0 [ERROR] Failed to initialize plugins.
2017-02-21T22:21:02.930791Z 0 [ERROR] Aborting
2017-02-21T22:21:02.930844Z 0 [Note] Binlog end
2017-02-21T22:21:02.963074Z 0 [Note] Shutting down plugin 'MyISAM'
2017-02-21T22:21:02.974376Z 0 [Note] Shutting down plugin 'CSV'
2017-02-21T22:21:02.976428Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
2017-02-21T22:21:33.341664Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-02-21T22:21:33.341712Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-02-21T22:21:33.507439Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-02-21T22:21:33.508281Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.17-0ubuntu0.16.04.1) starting as process 3540 ...
2017-02-21T22:21:33.512107Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-02-21T22:21:33.512136Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-02-21T22:21:33.512142Z 0 [Note] InnoDB: Uses event mutexes
2017-02-21T22:21:33.512147Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-02-21T22:21:33.512151Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-02-21T22:21:33.512156Z 0 [Note] InnoDB: Using Linux native AIO
2017-02-21T22:21:33.512335Z 0 [Note] InnoDB: Number of pools: 1
2017-02-21T22:21:33.512419Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-02-21T22:21:33.513456Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-02-21T22:21:33.513498Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2017-02-21T22:21:33.513507Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2017-02-21T22:21:33.513513Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-02-21T22:21:33.513519Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-02-21T22:21:33.513523Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-02-21T22:21:33.513528Z 0 [ERROR] Failed to initialize plugins.
2017-02-21T22:21:33.513531Z 0 [ERROR] Aborting
2017-02-21T22:21:33.513536Z 0 [Note] Binlog end
2017-02-21T22:21:33.513582Z 0 [Note] Shutting down plugin 'MyISAM'
2017-02-21T22:21:33.513594Z 0 [Note] Shutting down plugin 'CSV'
2017-02-21T22:21:33.513812Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
2017-02-21T22:22:04.167611Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-02-21T22:22:04.167667Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-02-21T22:22:04.765319Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-02-21T22:22:04.954937Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.17-0ubuntu0.16.04.1) starting as process 3671 ...
2017-02-21T22:22:05.854161Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-02-21T22:22:05.854237Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-02-21T22:22:05.854246Z 0 [Note] InnoDB: Uses event mutexes
2017-02-21T22:22:05.854252Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-02-21T22:22:05.854257Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-02-21T22:22:05.854262Z 0 [Note] InnoDB: Using Linux native AIO
2017-02-21T22:22:05.971615Z 0 [Note] InnoDB: Number of pools: 1
2017-02-21T22:22:06.057393Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-02-21T22:22:06.058781Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-02-21T22:22:06.059824Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2017-02-21T22:22:06.059845Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2017-02-21T22:22:06.059853Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-02-21T22:22:06.059861Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-02-21T22:22:06.059866Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-02-21T22:22:06.059872Z 0 [ERROR] Failed to initialize plugins.
2017-02-21T22:22:06.059876Z 0 [ERROR] Aborting
2017-02-21T22:22:06.059887Z 0 [Note] Binlog end
2017-02-21T22:22:06.071730Z 0 [Note] Shutting down plugin 'MyISAM'
2017-02-21T22:22:06.077481Z 0 [Note] Shutting down plugin 'CSV'
2017-02-21T22:22:06.089287Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
答案1
解决方案出奇的简单。我将分配的内存量改为 1024,mysql-server
安装后没有任何问题。
这是新的Vagrantfile
Vagrant.configure("2") do |config|
# create mgmt node
config.vm.define :mgmt do |mgmt_config|
# the machine doing the provisioning. (my laptop probobly)
mgmt_config.vm.box = "bento/ubuntu-16.04"
mgmt_config.vm.hostname = "mgmt"
mgmt_config.vm.network :private_network, ip: "10.0.15.10"
mgmt_config.vm.provider "virtualbox" do |vb|
vb.memory = "256"
end
mgmt_config.vm.provision :shell, path: "bootstrap-mgmt.sh"
end
config.vm.define :node do |node|
# the droplet to provision
node.vm.box = "bento/ubuntu-16.04"
node.vm.hostname = "web1"
node.vm.network :private_network, ip: "10.0.15.11"
node.vm.network "forwarded_port", guest: 80, host: 8080
node.vm.provider "virtualbox" do |vb|
vb.memory = "1024" # changed this line
end
end
end
答案2
Mysql 5.7 与 5.5 相比有许多重大变化,因此如果您之前有一些较旧的安装和/或一些数据库,/var/lib/mysql
则可能需要进行一些调整才能升级到 5.7。
最简单的解决方案(清除所有现有的conf和数据库):
sudo dpkg -P mysql-server
更好的方法是彻底检查您的配置,看看哪些与 5.7 不兼容。如果您的配置正确,安装将在需要时转换所有旧数据库。