Configuring InnoDB for MySQL database on Mac - mysql

I'm configuring a Mac 10.6 server and I'm having trouble configuring MySQL to support InnoDB.
MySQL starts and works without a problem with my original my.cnf file. Here it is:
[mysqld]
#Don't resolve hostnames. All hostnames are IP's or 'localhost'.
skip-name-resolve
#Don't give threads different priorities.
skip-thread-priority
However, when I add this to support InnoDB, MySQL will not start.
[mysqld]
#Don't resolve hostnames. All hostnames are IP's or 'localhost'.
skip-name-resolve
#Don't give threads different priorities.
skip-thread-priority
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir=/var/mysql/
innodb_data_file_path=ibdata1:2000M;ibdata2:10M:autoextend
innodb_log_group_home_dir=/var/mysql/
innodb_log_arch_dir=/var/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size=384M
innodb_additional_mem_pool_size=20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size=100M
innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
innodb_lock_wait_timeout=50
I confirmed that /var/mysql/ exists and has correct permissions. I'm not sure how to troubleshoot mysql to learn what is causing the problem.
MySQL is located at /usr/local/ :
lrwxr-xr-x 1 root wheel 24 Aug 26 12:17 mysql -> mysql-5.5.15-osx10.6-x86
drwxr-xr-x 16 root wheel 544 Jul 13 16:26 mysql-5.5.15-osx10.6-x86
Thank you very much for your help.
Mike
=========
Here are several lines from the end of the log file:
111027 14:41:07 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.5.15' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)
111027 21:48:57 [Note] /usr/local/mysql/bin/mysqld: Normal shutdown
111027 21:48:57 [Note] Event Scheduler: Purging the queue. 0 events
111027 21:48:57 InnoDB: Starting shutdown...
111027 21:48:57 InnoDB: Shutdown completed; log sequence number 1595675
111027 21:48:57 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
111027 21:49:47 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
111027 21:49:47 [Warning] The --skip-thread-priority startup option is deprecated and will be removed in MySQL 7.0. This option has no effect as the implied behavior is already the default.
111027 21:49:47 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
111027 21:49:47 [Note] Plugin 'FEDERATED' is disabled.
111027 21:49:47 InnoDB: The InnoDB memory heap is disabled
111027 21:49:47 InnoDB: Mutexes and rw_locks use GCC atomic builtins
111027 21:49:47 InnoDB: Compressed tables use zlib 1.2.3
111027 21:49:47 InnoDB: Initializing buffer pool, size = 128.0M
111027 21:49:47 InnoDB: Completed initialization of buffer pool
111027 21:49:47 InnoDB: highest supported file format is Barracuda.
111027 21:49:47 InnoDB: Waiting for the background threads to start
111027 21:49:48 InnoDB: 1.1.8 started; log sequence number 1595675
111027 21:49:48 [Warning] 'user' entry 'root#myservername.local' ignored in --skip-name-resolve mode.
111027 21:49:48 [Warning] 'user' entry '#myservername.local' ignored in --skip-name-resolve mode.
111027 21:49:48 [Warning] 'proxies_priv' entry '# root#myservername.local' ignored in --skip-name-resolve mode.
111027 21:49:48 [Note] Event Scheduler: Loaded 0 events
111027 21:49:48 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.5.15' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)
111027 21:53:04 [Note] /usr/local/mysql/bin/mysqld: Normal shutdown
111027 21:53:04 [Note] Event Scheduler: Purging the queue. 0 events
111027 21:53:04 InnoDB: Starting shutdown...
111027 21:53:04 InnoDB: Shutdown completed; log sequence number 1595675
111027 21:53:04 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
I'm not sure how to read this. Can you assist?
Mike

What is in your mysql error log file? That usually will tell you why mysql won't start. If you don't know where your log file is, in mysql run this command:
show variables like "%log_error%";
The you can tail that file to see what the error was. Of course, you will need to turn Innodb support off so you can start mysql to run the above command. Then you can shutdown mysql, enable Innodb and try starting it again. Then look at the log file.

Related

InnoDB: Header page consists of zero bytes in datafile: ./ibdata1

I am deploying MySQL on openshift (kubernetes) but getting below error
---> 10:01:34 Initializing database ...
---> 10:01:34 Running /opt/rh/rh-mysql57/root/usr/libexec/mysqld --initialize --datadir=/var/lib/mysql/data --ignore-db-dir=lost+found
---> 10:01:35 Starting MySQL server with disabled networking ...
---> 10:01:35 Waiting for MySQL to start ...
2019-10-18T10:01:35.188509Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-10-18T10:01:35.188567Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2019-10-18T10:01:35.325995Z 0 [Note] /opt/rh/rh-mysql57/root/usr/libexec/mysqld (mysqld 5.7.24) starting as process 40 ...
2019-10-18T10:01:35.430574Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-10-18T10:01:35.430612Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-10-18T10:01:35.430621Z 0 [Note] InnoDB: Uses event mutexes
2019-10-18T10:01:35.430627Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-10-18T10:01:35.430634Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.7
2019-10-18T10:01:35.430642Z 0 [Note] InnoDB: Using Linux native AIO
2019-10-18T10:01:35.431024Z 0 [Note] InnoDB: Number of pools: 1
2019-10-18T10:01:35.431174Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-10-18T10:01:35.433296Z 0 [Note] InnoDB: Initializing buffer pool, total size = 2G, instances = 8, chunk size = 128M
2019-10-18T10:01:35.584269Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-10-18T10:01:35.610249Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-10-18T10:01:35.624480Z 0 [ERROR] InnoDB: Header page consists of zero bytes in datafile: ./ibdata1, Space ID:0, Flags: 0. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2019-10-18T10:01:35.624518Z 0 [ERROR] InnoDB: Corrupted page [page id: space=0, page number=0] of datafile './ibdata1' could not be found in the doublewrite buffer.
2019-10-18T10:01:35.624667Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
---> 10:01:36 Waiting for MySQL to start ...
2019-10-18T10:01:36.225356Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-10-18T10:01:36.225372Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-10-18T10:01:36.225377Z 0 [ERROR] Failed to initialize builtin plugins.
2019-10-18T10:01:36.225380Z 0 [ERROR] Aborting
2019-10-18T10:01:36.225393Z 0 [Note] Binlog end
2019-10-18T10:01:36.225454Z 0 [Note] Shutting down plugin 'CSV'
2019-10-18T10:01:36.233760Z 0 [Note] /opt/rh/rh-mysql57/root/usr/libexec/mysqld: Shutdown complete
I searched on google and they recommend to do following
rm -rf /var/lib/mysql/ib_logfile*
but as you know in docker and kubernetes world as soon as pod is not able to come up we cant login to pod and delete these files. Due to this error MySQL pod is not coming up.
I am using glusterfs and i deleted PVC and recreated but still same error.
Update1:
After recommendation of #Crou i did following changes
I downloaded new "centos/mysql-57-centos7:5.7" image and retry still same issue
I used mysql:5.7 image and now its throwing following error
I deleted PVC and recreated with different size but still same error.
[ERROR] --initialize specified but the data directory has files in it. Aborting.
[ERROR] Aborting
It seems to me that your image is broken, or at least the data you are trying to load.
Even if you do remove the files /var/lib/mysql/ib_logfile* this will break again when pod will be rescheduled.
You can try getting into the pod using kubectl exec -it <pod_name> bash when it is still starting and quickly do the changes. If it's already too late and it just fails within few seconds with crashloopbackoff, you might try fixing this in the dockerfile that is being used to crate the image. If you have no access to the dockerfile, you can create your own dockerfile and build image based on it.
Here is a documentation with Dockerfile reference that might be helpful.
Dockerfile include something like this:
FROM oraclelinux:7-slim
RUN rm -rf /var/lib/mysql/ib_logfile*
EXPOSE 3306 6606 6446 6447 33060
CMD [""]
Please keep in mind this is just a short example and might not work on it self.
I was able to find this github mattlord/Docker-InnoDB-Cluster, maybe it will be of help.
After different retries i am able to solve issues, Following are findings
I observed that when first time i recreate PVC and deploy mysql it take too much time at this line
Running /opt/rh/rh-mysql57/root/usr/libexec/mysqld --initialize --datadir=/var/lib/mysql/data --ignore-db-dir=lost+found
During this time LiveProbe time exaust and it restart the container, which result in subjected error.
I increased the time of initialDelaySeconds under livenessProbe to 240, this time it started mysql after 4 mins
After 4 minutes it shows Starting MySQL server with disabled networking and start doing further.
My applications are able to connect it but i dont know what would be the impact of this?
---> 16:18:24 Running /opt/rh/rh-mysql57/root/usr/libexec/mysqld --initialize --datadir=/var/lib/mysql/data --ignore-db-dir=lost+found
---> 16:22:15 Starting MySQL server with disabled networking ...
---> 16:22:15 Waiting for MySQL to start ...
2019-10-18T16:22:15.752499Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-10-18T16:22:15.772646Z 0 [Note] /opt/rh/rh-mysql57/root/usr/libexec/mysqld (mysqld 5.7.24) starting as process 69 ...
2019-10-18T16:22:15.849580Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-10-18T16:22:15.849613Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-10-18T16:22:15.849617Z 0 [Note] InnoDB: Uses event mutexes
2019-10-18T16:22:15.849621Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-10-18T16:22:15.849624Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.7
2019-10-18T16:22:15.849629Z 0 [Note] InnoDB: Using Linux native AIO
2019-10-18T16:22:15.850236Z 0 [Note] InnoDB: Number of pools: 1
2019-10-18T16:22:15.850459Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-10-18T16:22:15.852211Z 0 [Note] InnoDB: Initializing buffer pool, total size = 2G, instances = 8, chunk size = 128M
2019-10-18T16:22:15.978704Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-10-18T16:22:16.005183Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-10-18T16:22:16.208237Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-10-18T16:22:16.402086Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-10-18T16:22:16.414708Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
---> 16:22:17 Waiting for MySQL to start ...
---> 16:22:18 Waiting for MySQL to start ...
2019-10-18T16:22:18.601639Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-10-18T16:22:18.608922Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2019-10-18T16:22:18.608943Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2019-10-18T16:22:18.609240Z 0 [Note] InnoDB: Waiting for purge to start
2019-10-18T16:22:18.659387Z 0 [Note] InnoDB: 5.7.24 started; log sequence number 2592555
2019-10-18T16:22:18.659667Z 0 [Note] Plugin 'FEDERATED' is disabled.
2019-10-18T16:22:18.663687Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/data/ib_buffer_pool
2019-10-18T16:22:18.808093Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2019-10-18T16:22:18.808117Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2019-10-18T16:22:18.825225Z 0 [Warning] CA certificate ca.pem is self signed.
2019-10-18T16:22:18.828435Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2019-10-18T16:22:18.885079Z 0 [Note] InnoDB: Buffer pool(s) load completed at 191018 16:22:18
2019-10-18T16:22:18.948358Z 0 [Warning] 'user' entry 'root#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:18.948397Z 0 [Warning] 'user' entry 'mysql.session#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:18.948404Z 0 [Warning] 'user' entry 'mysql.sys#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:18.948428Z 0 [Warning] 'db' entry 'performance_schema mysql.session#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:18.948435Z 0 [Warning] 'db' entry 'sys mysql.sys#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:18.948448Z 0 [Warning] 'proxies_priv' entry '# root#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:19.034170Z 0 [Warning] 'tables_priv' entry 'user mysql.session#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:19.034191Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys#localhost' ignored in --skip-name-resolve mode.
2019-10-18T16:22:19.633088Z 0 [Note] Event Scheduler: Loaded 0 events
2019-10-18T16:22:19.633217Z 1 [Note] Event Scheduler: scheduler thread started with id 1
2019-10-18T16:22:19.633316Z 0 [Note] /opt/rh/rh-mysql57/root/usr/libexec/mysqld: ready for connections.
Version: '5.7.24' socket: '/tmp/mysql.sock' port: 0 MySQL Community Server (GPL)
2019-10-18T16:22:19.634316Z 3 [Note] Your password has expired. To log in you must change it using a client that supports expired passwords.
---> 16:22:19 MySQL started successfully
---> 16:22:19 Setting password for MySQL root user ...

Can't restart MySQL caused by InnoDB

I can't restart MySQL or recover MySQL from ( InnoDB tables )
I have one WSL using Ubuntu 16.04. By "unknown" accident, at morning i can't access MySQL. Tried to restart it and ... all errors.
Tried with all advice about InnoDB & log* files. But not success.
I did backup /var/lib/mysql and re-install new instance of WSL - Ubuntu 16.04
Tried to recover from physical backup files ( log* & data files & database directory ). But still have same errors.
[Update 1]
Follow this guide: https://dba.stackexchange.com/questions/71596/restoring-mysql-tables-from-ibd-frm-and-mysqllogbin-files
I have re-installed another WSL
Follow guide to restore db from .frm & .idb
Everything goes well until IMPORT TABLESPACE.
MySQL keep saying :
ERROR 1812 (HY000): Tablespace is missing for table `dbname`.`table`
2019-05-16T03:04:36.061132Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2019-05-16T03:04:36.207628Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2019-05-16T03:04:36.208347Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2019-05-16T03:04:36.472045Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-05-16T03:04:36.481592Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.26-0ubuntu0.16.04.1) starting as process 15703 ...
2019-05-16T03:04:36.503219Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-05-16T03:04:36.503655Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-05-16T03:04:36.503712Z 0 [Note] InnoDB: Uses event mutexes
2019-05-16T03:04:36.503749Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-05-16T03:04:36.503783Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2019-05-16T03:04:36.503823Z 0 [Note] InnoDB: Using Linux native AIO
2019-05-16T03:04:36.504677Z 0 [Note] InnoDB: Number of pools: 1
2019-05-16T03:04:36.505431Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-05-16T03:04:36.521629Z 0 [ERROR] InnoDB: Linux Native AIO interface is not supported on this platform. Please check your OS documentation and install appropriate binary of InnoDB.
2019-05-16T03:04:36.521855Z 0 [Note] InnoDB: You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my.cnf
2019-05-16T03:04:36.521899Z 0 [Warning] InnoDB: Linux Native AIO disabled.
2019-05-16T03:04:36.525155Z 0 [Note] InnoDB: Initializing buffer pool, total size = 4G, instances = 8, chunk size = 128M
2019-05-16T03:04:37.245621Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-05-16T03:04:37.452784Z 0 [Note] InnoDB: page_cleaner coordinator priority: -20
2019-05-16T03:04:37.453044Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.453378Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.453477Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.461387Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-05-16T03:04:37.587188Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 22709914082 and the end 22709914054.
2019-05-16T03:04:37.587391Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-05-16T03:04:37.890878Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-05-16T03:04:37.891081Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-05-16T03:04:37.891128Z 0 [ERROR] Failed to initialize builtin plugins.
2019-05-16T03:04:37.891164Z 0 [ERROR] Aborting
2019-05-16T03:04:37.891207Z 0 [Note] Binlog end
2019-05-16T03:04:37.891332Z 0 [Note] Shutting down plugin 'CSV'
2019-05-16T03:04:37.891962Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
2019-05-16T03:04:37.959132Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended ````
For [ERROR] InnoDB: Linux Native AIO interface is not supported on this platform. Please check your OS documentation and install appropriate binary of InnoDB.:
Solution: Add the following lines at /etc/mysql/my.cnf
[mysqld]
innodb_use_native_aio = 0
For [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 92858715 and the end 92858687.:
Solution: Delete the ib_logfiles from /var/lib/mysql
sudo rm -rf /var/lib/mysql/ib_logfile*
I had a similar problem. I was using MySQL in docker but this solution is same for both. You need to remove ib_logfiles
If you are not using docker then
rm -rf /var/lib/mysql/ib_logfile*
And if you using docker then
cd /your_mount_path/
then run
rm -rf * ib_logfile*
Note: Make sure you make a backup of the data or volume as I ended up losing my data.
if anyone's ended up here struggling with wix-embedded-mysql and for some reason can't change the mysql settings in your WSL distro or host unix system, you can just disable it through the custom mysqld setting .withServerVariable like:
.withServerVariable("innodb_use_native_aio", 0)
That option's only doable if you really don't care about InnoDB usage in your code though.

ERROR 1049 (42000): Unknown database 'test'

I am trying to install mySQL server on CentOS6.6 without root access.
Here are my steps.
Unpack mysql-8.0.11-linux-glibc2.12-i686 in a directory(EX:[Base MySQL Directory])
Initialize and generate root password:
./mysqld --initialize --user=mysql --lc_messages_dir=[Base MySQL Directory]/share --basedir=[Base MySQL Directory] --datadir=[BaseMySQL Directory]/data --log-error=[Base MySQL Directory]/data/mysql.err --pid-file=[Base MySQL Directory]/mysql.pid --socket=[Base MySQL Directory]/thesock --port=3306 &
Start the server:
./mysqld --user=mysql --basedir=[Base MySQL Directory] --lc_messages_dir=[Base MySQL Directory]/share --datadir=[Base MySQL Directory]/data --log-error=[Base MySQL Directory]/data/mysql.err --pid-file=[Base MySQL Directory]/mysql.pid --socket=[Base MySQL Directory]/thesock --port=3306 &
Access MySQL database:
./mysql --socket=$MYSQL_TED_HOME/thesock --user=root --password="IL-Rp=Wj*3dg"
But I got an Error message:
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1049 (42000): Unknown database 'test'
I know there are already tons of questions like "ERROR 1049 (42000): Unknown database....
". But I couldn't find any of them is similar to mine.
Here is "mysql.err":
[Warning] Changed limits: max_open_files: 1024 (requested 5000)
[Warning] Changed limits: table_open_cache: 431 (requested 2000)
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[Warning] One can only use the --user switch if running as root
[Warning] InnoDB: New log files created, LSN=45790
[Warning] InnoDB: Creating foreign key constraint system tables.
[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: ec2d7935-43d0-11e8-96ee-d89d6726c984.
[Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
[Note] A temporary password is generated for root#localhost: IL-Rp=Wj*3dg
[Warning] Changed limits: max_open_files: 1024 (requested 5000)
[Warning] Changed limits: table_open_cache: 431 (requested 2000)
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
[Note] ./mysqld (mysqld 5.7.13) starting as process 6390 ...
[Warning] One can only use the --user switch if running as root
[Note] InnoDB: PUNCH HOLE support not available
[Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
[Note] InnoDB: Uses event mutexes
[Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
[Note] InnoDB: Compressed tables use zlib 1.2.3
[Note] InnoDB: Using Linux native AIO
[Note] InnoDB: Number of pools: 1
[Note] InnoDB: Using CPU crc32 instructions
[Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
[Note] InnoDB: Completed initialization of buffer pool
[Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
[Note] InnoDB: Highest supported file format is Barracuda.
[Note] InnoDB: Creating shared tablespace for temporary tables
[Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
[Note] InnoDB: File './ibtmp1' size is now 12 MB.
[Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
[Note] InnoDB: 32 non-redo rollback segment(s) are active.
[Note] InnoDB: Waiting for purge to start
[Note] InnoDB: 5.7.13 started; log sequence number 2524437
[Note] InnoDB: Loading buffer pool(s) from [Base MySQL Directory]/mysql-5.7.13-linux-glibc2.5-x86_64/data/ib_buffer_pool
[Note] Plugin 'FEDERATED' is disabled.
[Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
[Note] Server hostname (bind-address): '*'; port: 3306
[Note] IPv6 is available.
[Note] - '::' resolves to '::';
[Note] Server socket created on IP: '::'.
[Note] InnoDB: Buffer pool(s) load completed at 180419 20:55:57
[Note] Event Scheduler: Loaded 0 events
[Note] ./mysqld: ready for connections.
Version: '5.7.13' socket: '[Base MySQL Directory]/thesock' port: 3306 MySQL Community Server (GPL)

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

MySQL 5.5 not shutting down on mac

I have a problem shutting down the mysql server that is running on my mac. I tried from ActivityMonitor, from terminal using "mysqladmin shutdown" , kill -9 , and many other proposed ways but it always restarts within a second. Error log doesnt show anything strange:
30113 16:28:12 [Note] /usr/local/Cellar/mysql/5.5.25a/bin/mysqld: Normal shutdown
130113 16:28:12 [Note] Event Scheduler: Purging the queue. 0 events
130113 16:28:14 [Warning] /usr/local/Cellar/mysql/5.5.25a/bin/mysqld: Forcing close of thread 3 user: 'root'
130113 16:28:14 InnoDB: Starting shutdown...
130113 16:28:15 InnoDB: Shutdown completed; log sequence number 2614644
130113 16:28:15 [Note] /usr/local/Cellar/mysql/5.5.25a/bin/mysqld: Shutdown complete
130113 16:28:15 mysqld_safe mysqld from pid file /usr/local/var/mysql/mun07066.local.pid ended
130113 16:28:15 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
130113 16:28:15 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
130113 16:28:15 [Warning] One can only use the --user switch if running as root
130113 16:28:15 InnoDB: The InnoDB memory heap is disabled
130113 16:28:15 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130113 16:28:15 InnoDB: Compressed tables use zlib 1.2.5
130113 16:28:15 InnoDB: Initializing buffer pool, size = 128.0M
130113 16:28:15 InnoDB: Completed initialization of buffer pool
130113 16:28:15 InnoDB: highest supported file format is Barracuda.
130113 16:28:16 InnoDB: Waiting for the background threads to start
130113 16:28:17 InnoDB: 1.1.8 started; log sequence number 2614644
130113 16:28:17 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
130113 16:28:17 [Note] - '0.0.0.0' resolves to '0.0.0.0';
130113 16:28:17 [Note] Server socket created on IP: '0.0.0.0'.
130113 16:28:17 [Note] Event Scheduler: Loaded 0 events
130113 16:28:17 [Note] /usr/local/Cellar/mysql/5.5.25a/bin/mysqld: ready for connections.
Version: '5.5.25a' socket: '/tmp/mysql.sock' port: 3306 Source distribution