MySQL not starting on XAMP and HeidiSQL - mysql

I cannot start MySQL with XAMPP and I do not get any errors. So if I click on "Start", I get the message "01:26:41 [mysql] Attempting to start MySQL service..." and that's it.
The problem may be, because I have also installed HeidiSQL, which comes with MariaDB. I know that both of them use the same port (3306) and I have tried to change the port of MariaDB to 3308.
This is the content of my.ini:
[mysqld]
port= 3306
socket = "C:/xampp/mysql/mysql.sock"
basedir = "C:/xampp/mysql"
tmpdir = "C:/xampp/tmp"
datadir = "C:/xampp/mysql/data"
pid_file = "mysql.pid"
# enable-named-pipe
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error = "mysql_error.log"
datadir=C:/Program Files/MariaDB 10.3/data
port=3308
innodb_buffer_pool_size=2033M
character-set-server=utf8
[client]
port=3308
plugin-dir=C:/Program Files/MariaDB 10.3/lib/plugin
mysql_error.log:
2019-07-24 1:18:11 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2019-07-24 1:18:11 0 [Note] InnoDB: Uses event mutexes
2019-07-24 1:18:11 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-07-24 1:18:11 0 [Note] InnoDB: Number of pools: 1
2019-07-24 1:18:11 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-07-24 1:18:11 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2019-07-24 1:18:11 0 [Note] InnoDB: Completed initialization of buffer pool
2019-07-24 1:18:11 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=1791378
2019-07-24 1:18:11 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-07-24 1:18:11 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2019-07-24 1:18:11 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-07-24 1:18:11 0 [Note] InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-07-24 1:18:11 0 [Note] InnoDB: File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB.
2019-07-24 1:18:11 0 [Note] InnoDB: Waiting for purge to start
2019-07-24 1:18:11 0 [Note] InnoDB: 10.3.16 started; log sequence number 1791387; transaction id 163
2019-07-24 1:18:11 0 [Note] InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
2019-07-24 1:18:11 0 [Note] InnoDB: Buffer pool(s) load completed at 190724 1:18:11
2019-07-24 1:18:11 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-07-24 1:18:11 0 [Note] Server socket created on IP: '::'.
2019-07-24 1:18:11 0 [Note] Reading of all Master_info entries succeeded
2019-07-24 1:18:11 0 [Note] Added new Master_info '' to hash table
2019-07-24 1:18:11 0 [Note] mysql\bin\mysqld.exe: ready for connections.
Version: '10.3.16-MariaDB' socket: '' port: 3307 mariadb.org binary distribution
I have tried all answers from that questions but none of them worked for me.
Not only XAMPP, I can't even get a connection with HeidiSQL. The error message is:
Can't connect to MySQL server on '127.0.0.1' (10061)
I have uninstalled both of them, XAMPP and HeidiSQL and installed them again. Even that didn't help. Any help would be appreciated!

HeidiSQL would just connect over port 3306 to your MySQL instance, but it does not listen to any port, so it does not use any port as you say.
So your problem is the non-starting MySQL service.
Your my.ini looks as if you already have two services running:
one from C:\Program Files\MariaDB 10.3\
and one from C:\xampp\mysql\
Have a look in your services control panel, e.g. by running services.msc from your start menu. Then, watch out for services named "MySQL" or "MariaDB", or one with some version number in it.
Your my.ini contains two port definitions in the [mysqld] section, which could mean your Xamp/MySQL still wants port 3306, ignoring the later 3308. That again would explain why your service does not start, if your MariaDB service still runs.
Not knowing anything about the intention for installing MariaDB, I'd recommend to uninstall it, or at least change the service startup option to manually:

Related

Galera Mysql wsrep_cluster_status stays Disconnected

My cluster was previously running, I have made these config changes and now Galera cluster bootstrap is not working.
I tried bootstraping with /usr/bin/mysqld_bootstrap as well as service mysql start --wsrep-new-cluster . but no luck.
mysql> SHOW GLOBAL STATUS WHERE Variable_name IN ('wsrep_ready', 'wsrep_cluster_size', 'wsrep_cluster_status', 'wsrep_connected');
+----------------------+--------------+
| Variable_name | Value |
+----------------------+--------------+
| wsrep_cluster_size | 0 |
| wsrep_cluster_status | Disconnected |
| wsrep_connected | OFF |
| wsrep_ready | ON |
+----------------------+--------------+
4 rows in set (0.00 sec)
root#hostname:/var/lib/mysql# cat /etc/my.cnf
[mysqld]
# character set
character_set_server = utf8
collation_server = utf8_general_ci
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
binlog_format=ROW
# Galera Cluster Configuration
wsrep_node_address="ip"
wsrep_node_name="hostname"
wsrep_cluster_name="mysql_cluster"
wsrep_cluster_address="gcomm://"
wsrep_provider_options = "gcache.size = 16G; gcache.recover = yes; gmcast.segment=0; gmcast.time_wait=PT5S; cert.log_conflicts=ON;"
wsrep_retry_autocommit=5
wsrep_slave_threads=64
wsrep_log_conflicts=ON
wsrep_provider=/usr/lib/libgalera_smm.so
wsrep_sst_method=rsync # Galera Synchronization Configuration
# wsrep_certify_nonPK=1 # make sure primary key is present in a DB
# Mysql configurations
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=2
innodb_buffer_pool_size=20G # 80% of total memory
table_open_cache=8192
max_connections=500
innodb_buffer_pool_instances=40
thread_cache_size=128
max_allowed_packet=16M
thread_stack=192K
[mysql_safe]
log-error=/var/log/mysql/error.log
pid-file=/var/run/mysqld/mysqld.pid
#include mysql config
!includedir /etc/mysql/conf.d/
error.log
2020-05-10T14:52:11.510387Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-05-10T14:52:11.512408Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.29-log) starting as process 38762 ...
2020-05-10T14:52:11.516208Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-05-10T14:52:11.516233Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-05-10T14:52:11.516240Z 0 [Note] InnoDB: Uses event mutexes
2020-05-10T14:52:11.516246Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-05-10T14:52:11.516251Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-05-10T14:52:11.516259Z 0 [Note] InnoDB: Using Linux native AIO
2020-05-10T14:52:11.516566Z 0 [Note] InnoDB: Number of pools: 1
2020-05-10T14:52:11.516689Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-05-10T14:52:11.518701Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-05-10T14:52:11.528085Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-05-10T14:52:11.530536Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-05-10T14:52:11.542537Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-05-10T14:52:11.559072Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-05-10T14:52:11.559138Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-05-10T14:52:11.601120Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-05-10T14:52:11.602357Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-05-10T14:52:11.602377Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-05-10T14:52:11.602854Z 0 [Note] InnoDB: Waiting for purge to start
2020-05-10T14:52:11.653077Z 0 [Note] InnoDB: 5.7.29 started; log sequence number 3779657135
2020-05-10T14:52:11.653388Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-05-10T14:52:11.653670Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-05-10T14:52:11.656614Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200510 7:52:11
2020-05-10T14:52:11.665175Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-05-10T14:52:11.665203Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-05-10T14:52:11.666274Z 0 [Warning] CA certificate ca.pem is self signed.
2020-05-10T14:52:11.666344Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-05-10T14:52:11.667341Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2020-05-10T14:52:11.667427Z 0 [Note] IPv6 is available.
2020-05-10T14:52:11.667444Z 0 [Note] - '::' resolves to '::';
2020-05-10T14:52:11.667487Z 0 [Note] Server socket created on IP: '::'.
2020-05-10T14:52:11.686718Z 0 [Note] Event Scheduler: Loaded 0 events
2020-05-10T14:52:11.686771Z 0 [Note] WSREP: Initial position: 00000000-0000-0000-b0f1-bf0300000000:62901600
2020-05-10T14:52:11.686784Z 0 [Warning] WSREP: Initial position was provided by configuration or SST, avoiding override
2020-05-10T14:52:11.686792Z 0 [Note] WSREP: wsrep_load(): loading provider library 'none'
2020-05-10T14:52:11.687082Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.29-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Wsrep Server (GPL), wsrep_25.21
2020-05-10T14:52:12.732431Z 2 [Note] Access denied for user 'root'#'localhost' (using password: NO)
2020-05-10T14:57:11.957879Z 4 [Note] WSREP: Stop replication
2020-05-10T14:57:11.957918Z 4 [Note] Giving 1 client threads a chance to die gracefully
Make sure it belongs to mysql user and mysql group
chown mysql:mysql /etc/my.cnf
Also, and very important, make sure the library is in /etc/my.cnf
symbolic-links=0
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
The file /etc/my.cnf was missing read permissions. This file requires read permission for mysql user. I have set the permission to 755 and Galera configuration was loaded properly.
chmod 775 /etc/my.cnf

MAMP SQLSTATE[HY000] [2006] MySQL server has gone away on Mac Catalina

I googled and the solution was to add/edit this:
[mysqld]
wait_timeout=100000
max_allowed_packet = 256M
into this file /etc/mysql/my.cnf and but i cant find etc, where is the etc?
mysql_error_log.err
2020-02-26T13:09:54.6NZ mysqld_safe Logging to
'/Applications/MAMP/logs/mysql_error_log.err'. 2020-02-26T13:09:54.6NZ
mysqld_safe Starting mysqld daemon with databases from
/Applications/MAMP/db/mysql57 2020-02-26T13:09:54.943202Z 0 [Warning]
TIMESTAMP with implicit DEFAULT value is deprecated. Please use
--explicit_defaults_for_timestamp server option (see documentation for more details). 2020-02-26T13:09:54.943551Z 0 [Note] --secure-file-priv
is set to NULL. Operations related to importing and exporting data are
disabled 2020-02-26T13:09:54.943611Z 0 [Note]
/Applications/MAMP/Library/bin/mysqld (mysqld 5.7.26) starting as
process 2189 ... 2020-02-26T13:09:54.949688Z 0 [Warning] Setting
lower_case_table_names=2 because file system for
/Applications/MAMP/db/mysql57/ is case insensitive
2020-02-26T13:09:54.952118Z 0 [Note] InnoDB: Mutexes and rw_locks use
GCC atomic builtins 2020-02-26T13:09:54.952159Z 0 [Note] InnoDB: Uses
event mutexes 2020-02-26T13:09:54.952176Z 0 [Note] InnoDB: GCC builtin
__atomic_thread_fence() is used for memory barrier 2020-02-26T13:09:54.952187Z 0 [Note] InnoDB: Compressed tables use
zlib 1.2.11 2020-02-26T13:09:54.952681Z 0 [Note] InnoDB: Number of
pools: 1 2020-02-26T13:09:54.952894Z 0 [Note] InnoDB: Using CPU crc32
instructions 2020-02-26T13:09:54.955089Z 0 [Note] InnoDB: Initializing
buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-02-26T13:09:54.971785Z 0 [Note] InnoDB: Completed initialization
of buffer pool 2020-02-26T13:09:54.990800Z 0 [Note] InnoDB: Highest
supported file format is Barracuda. 2020-02-26T13:09:55.005564Z 0
[Note] InnoDB: Creating shared tablespace for temporary tables
2020-02-26T13:09:55.005739Z 0 [Note] InnoDB: Setting file './ibtmp1'
size to 12 MB. Physically writing the file full; Please wait ...
2020-02-26T13:09:55.024819Z 0 [Note] InnoDB: File './ibtmp1' size is
now 12 MB. 2020-02-26T13:09:55.025655Z 0 [Note] InnoDB: 96 redo
rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-02-26T13:09:55.025678Z 0 [Note] InnoDB: 32 non-redo rollback
segment(s) are active. 2020-02-26T13:09:55.025883Z 0 [Note] InnoDB:
Waiting for purge to start 2020-02-26T13:09:55.079934Z 0 [Note]
InnoDB: 5.7.26 started; log sequence number 2551871
2020-02-26T13:09:55.080171Z 0 [Note] InnoDB: Loading buffer pool(s)
from /Applications/MAMP/db/mysql57/ib_buffer_pool
2020-02-26T13:09:55.080257Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-02-26T13:09:55.086927Z 0 [Warning] InnoDB: Table
mysql/innodb_table_stats has length mismatch in the column name
table_name. Please run mysql_upgrade 2020-02-26T13:09:55.086990Z 0
[Warning] InnoDB: Table mysql/innodb_index_stats has length mismatch
in the column name table_name. Please run mysql_upgrade
2020-02-26T13:09:55.090242Z 0 [Warning] Failed to set up SSL because
of the following SSL library error: SSL context is not usable without
certificate and private key 2020-02-26T13:09:55.090273Z 0 [Note]
Server hostname (bind-address): '*'; port: 3306
2020-02-26T13:09:55.090660Z 0 [Note] IPv6 is available.
2020-02-26T13:09:55.090721Z 0 [Note] - '::' resolves to '::';
2020-02-26T13:09:55.090868Z 0 [Note] Server socket created on IP:
'::'. 2020-02-26T13:09:55.093848Z 0 [Note] InnoDB: Buffer pool(s) load
completed at 200226 21:09:55 2020-02-26T13:09:55.173772Z 0 [Note]
Event Scheduler: Loaded 0 events 2020-02-26T13:09:55.173947Z 0 [Note]
/Applications/MAMP/Library/bin/mysqld: ready for connections. Version:
'5.7.26' socket: '/Applications/MAMP/tmp/mysql/mysql.sock' port:
3306 MySQL Community Server (GPL) 2020-02-26T13:10:18.977842Z 2
[Note] Got an error reading communication packets
You're using MAMP so you will need to create a new file in /Applications/MAMP/conf/ called my.conf
Your full file path will be /Applications/MAMP/conf/my.conf and the contents will be:
[mysqld]
wait_timeout=100000
max_allowed_packet = 256M
Once you've added the file you probably need to restart your mysql server in MAMP

Mysql 5.7 Could not create unix socket lock file

I am trying to create multiple instances of MySQL 5.7 in the same Ubuntu 16.10 32-bit box. I have copied the original data dir to the new one. Created separate log folder for the new instance(the logs are working). Changed the owner to mysql:mysql for the new data dir /var/lib/mysql2 and log dir /var/log/mysql2/. I have removed app-armor. I have posted this Question only after going through the other SO answers...none of which address the multiple instance issue.
Here is my my2.cnf:
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld2.pid
socket = /var/run/mysqld/mysqld2.sock
port = 3307
basedir = /usr
datadir = /var/lib/mysql2
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
#max_connections = 100
#table_open_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
[mysqld_safe]
socket = /var/run/mysqld/mysqld2.sock
nice = 0
As you can see I have changed the port to 3307 and others respectively. Now when I run (have to add the sudo to mysqld):
sudo mysqld --defaults-file=/etc/mysql/my2.cnf &
I receive:
2017-03-22T08:31:21.684121Z 0 [Note] mysqld (mysqld 5.7.17-0ubuntu0.16.10.1) starting as process 13676 ...
2017-03-22T08:31:21.687115Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-03-22T08:31:21.687131Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-22T08:31:21.687135Z 0 [Note] InnoDB: Uses event mutexes
2017-03-22T08:31:21.687140Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-03-22T08:31:21.687143Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-03-22T08:31:21.687147Z 0 [Note] InnoDB: Using Linux native AIO
2017-03-22T08:31:21.687281Z 0 [Note] InnoDB: Number of pools: 1
2017-03-22T08:31:21.687344Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2017-03-22T08:31:21.688116Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-03-22T08:31:21.693801Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-03-22T08:31:21.694846Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the $
2017-03-22T08:31:21.708807Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-22T08:31:21.776053Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-03-22T08:31:21.776228Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2017-03-22T08:31:21.825266Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2017-03-22T08:31:21.826338Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2017-03-22T08:31:21.826359Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2017-03-22T08:31:21.826695Z 0 [Note] InnoDB: Waiting for purge to start
2017-03-22T08:31:21.880277Z 0 [Note] InnoDB: 5.7.17 started; log sequence number 2535531
2017-03-22T08:31:21.881286Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql2/ib_buffer_pool
2017-03-22T08:31:21.881581Z 0 [Note] Plugin 'FEDERATED' is disabled.
2017-03-22T08:31:21.887687Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170322 14:01:21
2017-03-22T08:31:21.890330Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without cer$
2017-03-22T08:31:21.890380Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3307
2017-03-22T08:31:21.890407Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2017-03-22T08:31:21.890695Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2017-03-22T08:31:21.890791Z 0 [ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld2.sock.lock.
2017-03-22T08:31:21.890807Z 0 [ERROR] Unable to setup unix socket lock file.
2017-03-22T08:31:21.890819Z 0 [ERROR] Aborting
What am I missing?
check whether there is a lock file
ls /var/run/mysqld/mysqld2.sock.lock
1. if exists
1.1 check which process use the lock file
lsof /var/run/mysqld/mysqld2.sock.lock
1.1.1 if there is not a process using the lock file
rm lock file
rm /var/run/mysqld/mysqld2.sock.lock
and then start mysql
1.1.2 if there is a process using the lock file
change lock file and socket file to another path
2. if not exists
need more information to check what is happing
strace -ff mysqld --defaults-file=/etc/mysql/my2.cnf
For those who are using apparmor the following permissions in /etc/apparmor.d/usr.sbin.mysqld allowed mysqld to create and use the lock file.
/var/run/mysqld/mysqld2.pid rw,
/var/run/mysqld/mysqld2.sock rw,
/var/run/mysqld/mysqld2.sock.lock rw,
Then run the following as root to reload the profile.
apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld
For some reason i got OP's error without rw permissions on all three of these files.

MariaDB 10.0.16 crash during import of MySQL 5.1.70 dump

I have a small MySQL 5.1.70 InnoDB database: 4 tables; ~3K, ~23K, ~500K, ~600K rows. This runs on OpenBSD 5.4.
I'm in the process of upgrading to OpenBSD 5.7 which switches to MariaDB 10.0.16 (which AFAIK back-ports MySQL 5.6 features). To this end I built a little staging OpenBSD 5.7/MariaDB server so that I can test the upgrade. I've recreated the db schema to match the prod one and ran mysql_upgrade --force just to be safe.
Now i'd like to fill it with prod data. I dumped the data with:
$ mysqldump -u root -p --single-transaction --no-create-info \
--skip-add-drop-table --skip-extended-insert mydb > data_dump.sql
$ du -h data_dump.sql
116M data_dump.sql
The dump contains text/numbers, no blobs or binaries.
The problem is that MariaDB keeps aborting randomly while importing the first table in the dump, which is just ~23K rows.
staging $ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/wd0a 7.2G 3.5G 3.3G 51% /
staging $ mysql -u root -p -D mydb < data_dump.sql
Enter password:
ERROR 2013 (HY000) at line 8039: Lost connection to MySQL server during query
The line where it crashes is a normal INSERT no different from thousands before that one. In fact repeating the import again (after truncating tables and ensuring server starts ok) will NOT crash at the same line. I've seen it crash after 4000 rows, for example, same my.cnf. So I ruled out the bad data hypothesis.
The error log shows the following (from server startup to crash):
160211 12:07:05 mysqld_safe Starting mysqld daemon with databases from /var/mysql
160211 12:07:06 [Note] InnoDB: Using mutexes to ref count buffer pool pages
160211 12:07:06 [Note] InnoDB: The InnoDB memory heap is disabled
160211 12:07:06 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
160211 12:07:06 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
160211 12:07:06 [Note] InnoDB: Compressed tables use zlib 1.2.3
160211 12:07:06 [Note] InnoDB: Not using CPU crc32 instructions
160211 12:07:06 [Note] InnoDB: Initializing buffer pool, size = 128.0M
160211 12:07:06 [Note] InnoDB: Completed initialization of buffer pool
160211 12:07:06 [Note] InnoDB: Setting log file /var/mysql/ib_logfile101 size to 32 MB
160211 12:07:09 [Note] InnoDB: Setting log file /var/mysql/ib_logfile1 size to 32 MB
160211 12:07:11 [Note] InnoDB: Renaming log file /var/mysql/ib_logfile101 to /var/mysql/ib_logfile0
160211 12:07:11 [Warning] InnoDB: New log files created, LSN=27985430
160211 12:07:11 [Note] InnoDB: Highest supported file format is Barracuda.
160211 12:07:11 [Note] InnoDB: 128 rollback segment(s) are active.
160211 12:07:12 [Note] InnoDB: Waiting for purge to start
160211 12:07:12 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.22-71.0 started; log sequence number 27985932
160211 12:07:12 [Note] Server socket created on IP: '127.0.0.1'.
160211 12:07:12 [Note] Event Scheduler: Loaded 0 events
160211 12:07:12 [Note] /usr/local/libexec/mysqld: ready for connections.
Version: '10.0.16-MariaDB-log' socket: '/var/run/mysql/mysql.sock' port: 3306 OpenBSD port: mariadb-server-10.0.16v0
2016-02-11 12:09:34 c10b6700 InnoDB: Assertion failure in thread 3238749952 in file trx0purge.cc line 695
InnoDB: Failing assertion: purge_sys->rseg->last_page_no != FIL_NULL
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
Abort trap
160211 12:09:34 mysqld_safe mysqld restarted
160211 12:09:34 [Note] InnoDB: Using mutexes to ref count buffer pool pages
160211 12:09:34 [Note] InnoDB: The InnoDB memory heap is disabled
160211 12:09:34 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
160211 12:09:34 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
160211 12:09:34 [Note] InnoDB: Compressed tables use zlib 1.2.3
160211 12:09:34 [Note] InnoDB: Not using CPU crc32 instructions
160211 12:09:34 [Note] InnoDB: Initializing buffer pool, size = 128.0M
160211 12:09:35 [Note] InnoDB: Completed initialization of buffer pool
160211 12:09:35 [Note] InnoDB: Highest supported file format is Barracuda.
160211 12:09:35 [Note] InnoDB: Log scan progressed past the checkpoint lsn 31818497
160211 12:09:35 [Note] InnoDB: Database was not shutdown normally!
160211 12:09:35 [Note] InnoDB: Starting crash recovery.
160211 12:09:35 [Note] InnoDB: Reading tablespace information from the .ibd files...
160211 12:09:35 [Note] InnoDB: Restoring possible half-written data pages
160211 12:09:35 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 32140062
160211 12:09:36 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 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
InnoDB: Last MySQL binlog file position 0 2314577, file name ./binlog.000079
160211 12:09:36 [Note] InnoDB: 128 rollback segment(s) are active.
160211 12:09:36 [Note] InnoDB: Waiting for purge to start
160211 12:09:36 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.22-71.0 started; log sequence number 32140062
160211 12:09:37 [Note] Recovering after a crash using binlog
160211 12:09:37 [Note] Starting crash recovery...
160211 12:09:37 [Note] Crash recovery finished.
160211 12:09:37 [Note] Server socket created on IP: '127.0.0.1'.
160211 12:09:37 [Note] Event Scheduler: Loaded 0 events
160211 12:09:37 [Note] /usr/local/libexec/mysqld: ready for connections.
Version: '10.0.16-MariaDB-log' socket: '/var/run/mysql/mysql.sock' port: 3306 OpenBSD port: mariadb-server-10.0.16v0
I didn't have luck googling for the purge_sys->rseg->last_page_no != FIL_NULL failed assertion. Here's /etc/my.cnf file for MariaDB:
[client]
port = 3306
socket = /var/run/mysql/mysql.sock
[mysqld]
port = 3306
socket = /var/run/mysql/mysql.sock
datadir = /var/mysql
max_allowed_packet = 128M
table_open_cache = 64
sort_buffer_size = 128K
read_buffer_size = 512K
net_buffer_length = 64K
server-id = 1
general-log = 1
general_log_file = query.log
log-error = error.log
slow-query-log = 1
long_query_time = 2
slow_query_log_file = slow_queries.log
bind-address = 127.0.0.1
log-bin = binlog
binlog_format = mixed
max_binlog_size = 512M
key_buffer_size = 2M
read_rnd_buffer_size = 1M
innodb_data_home_dir = /var/mysql/
innodb_log_group_home_dir = /var/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_buffer_pool_size = 128M
innodb_log_file_size = 32M
innodb_log_buffer_size = 16M
innodb_lock_wait_timeout = 50
innodb_max_dirty_pages_pct = 1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[mysqlhotcopy]
interactive-timeout
Originally some of those params were set to lower values (still are on the prod MySQL) but the increase above had little success:
net_buffer_length was 2K
max_allowed_packet was 1M
innodb_buffer_pool_size was 64M
innodb_log_file_size was 5M
innodb_log_buffer_size was 8M
Also, increasing innodb_buffer_pool_size/innodb_log_file_size to 256M/64M seemed to post-pone the crash a little but didn't help significantly.
Short of breaking the import into small chunks I don't know what else to do. It seems to me this is a pretty small import file though. The staging server is an old iBook (500mhz ppc) with a non-SSD drive (3.3G free), but I did not notice any disk problems or high memory pressure (top reported 200+Mb free RAM) during the import.
What my.cnf params could cause this crash?
EDIT:
timeout info as requested:
MariaDB []> SHOW GLOBAL VARIABLES LIKE '%timeout';
+-----------------------------+----------+
| Variable_name | Value |
+-----------------------------+----------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| innodb_flush_log_at_timeout | 1 |
| innodb_lock_wait_timeout | 50 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| lock_wait_timeout | 31536000 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| slave_net_timeout | 3600 |
| thread_pool_idle_timeout | 60 |
| wait_timeout | 28800 |
+-----------------------------+----------+
It looks like this might be a bug, perhaps OpenBSD/PowerPC related. It has been reported to MariaDB developers here: http://mariadb.atlassian.net/browse/MDEV-9569

MySQL won't start on Linux

I have a fresh mysql-server install (installed via yum) that will not start
bash-4.1# /sbin/service mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]
The /etc/my.cnf has been set to default:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
The error I receive is:
2016-02-16T22:47:18.453320Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2016-02-16T22:47:18.888497Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-02-16T22:47:18.889955Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.11) starting as process 4321 ...
2016-02-16T22:47:19.016515Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-02-16T22:47:19.016568Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-02-16T22:47:19.016583Z 0 [Note] InnoDB: Uses event mutexes
2016-02-16T22:47:19.016596Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2016-02-16T22:47:19.016609Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-02-16T22:47:19.016631Z 0 [Note] InnoDB: Using Linux native AIO
2016-02-16T22:47:19.018127Z 0 [Note] InnoDB: Number of pools: 1
2016-02-16T22:47:19.018819Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-02-16T22:47:19.052517Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-02-16T22:47:19.071855Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-02-16T22:47:19.078235Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-02-16T22:47:19.092945Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-02-16T22:47:19.107542Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-02-16T22:47:19.107588Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-02-16T22:47:19.160738Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2016-02-16T22:47:19.163712Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-02-16T22:47:19.163748Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-02-16T22:47:19.165210Z 0 [Note] InnoDB: Waiting for purge to start
2016-02-16T22:47:19.215586Z 0 [Note] InnoDB: 5.7.11 started; log sequence number 1210437
2016-02-16T22:47:19.216328Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-02-16T22:47:19.217459Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-02-16T22:47:19.217537Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160216 22:47:19
mysqld: Table 'mysql.plugin' doesn't exist
2016-02-16T22:47:19.217905Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-02-16T22:47:19.219399Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-02-16T22:47:19.219650Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-02-16T22:47:19.220055Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2016-02-16T22:47:19.220231Z 0 [Note] IPv6 is available.
2016-02-16T22:47:19.220261Z 0 [Note] - '::' resolves to '::';
2016-02-16T22:47:19.220280Z 0 [Note] Server socket created on IP: '::'.
2016-02-16T22:47:19.233206Z 0 [Warning] Failed to open optimizer cost constant tables
2016-02-16T22:47:19.233439Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2016-02-16T22:47:19.233551Z 0 [ERROR] Aborting
However, I can't run mysql_upgrade as mysqld isn't running. Other sites have stated that file permissions of the data files could be an issue, but they are all owned by mysql (i.e. I believe correct). I've also tried running mysqld_safe, but without success.
Can someone please suggest what I've done wrong?
Thanks Mark.
mysql_install_db didn't work (was deprecated, and then the suggested initialise failed). However, a complete clean and reinstall resolved the issue.
For reference, the exact steps I performed were:
yum remove mysql
rm -fr /usr/bin/mysql
rm -fr /var/lib/mysql
rm -fr /etc/my*
(reboot)
yum install mysql-community-{server,client,common,libs}-*
/sbin/service mysqld start