Docker - Mysql container is restarting - mysql

I am running a docker container locally on Ubuntu VM. The container is constantly getting restarted.
Logs while running pod
Error response from daemon: Container 8345404f85a30f71d18e420eb064ef2104748f1f7b6d3a is restarting, wait until the container is running
Output of docker ps
8345404f85a3 mysql:5.7.23 "docker-entrypoint.s…" 5 minutes ago Restarting (1) 29 seconds ago
POD Error logs
2020-09-23T05:00:35.302191Z 0 [Warning] option 'max_binlog_size': unsigned value 10485760000 adjusted to 1073741824
2020-09-23T05:00:35.302252Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-09-23T05:00:35.303732Z 0 [ERROR] Could not open file '/var/log/mysql/error.log' for error logging: Is a directory
2020-09-23T05:00:35.307546Z 0 [ERROR] Aborting
Initializing database
2020-09-23T05:01:01.866333Z 0 [Warning] option 'max_binlog_size': unsigned value 10485760000 adjusted to 1073741824
2020-09-23T05:01:01.866398Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-09-23T05:01:01.872326Z 0 [ERROR] Could not open file '/var/log/mysql/error.log' for error logging: Is a directory
2020-09-23T05:01:01.872464Z 0 [ERROR] Aborting

It looks like that the error cannot open file /var/log/mysql/error.log is the primary problem. Yo should check if that location exists, and the permissions on it are correct. See this for a similar case: https://support.plesk.com/hc/en-us/articles/115004039393-Unable-to-start-mysql-var-log-mysql-error-log-Permission-denied. Maybe the image expects that there is a volume mounted for logging. Is there something about that in the documentation?

Related

error initializing database (may take a long time) mysql server

I'm trying installing MySQL server 8.0 (with error) and then uninstall it and trying to install 5.7 instead (I read people can get it works with 5.7) and the result is the same error. I don't know about the problem cause this is my first time using MySQL to learn it and stuck at the installation process. Here's the log of the installation process:
Beginning configuration step: Writing configuration file
Saving my.ini configuration file...
Saved my.ini configuration file.
Ended configuration step: Writing configuration file
Beginning configuration step: Updating Windows Firewall rules
Adding a Windows Firewall rule for MySQL57 on port 3306.
Attempting to add a Windows Firewall rule with command: netsh.exe advfirewall firewall add rule name="Port 3306" protocol=TCP localport=3306 dir=in action=allow
Ok.
Successfully added the Windows Firewall rule.
Ended configuration step: Updating Windows Firewall rules
Beginning configuration step: Adjusting Windows service
Attempting to grant Network Service require filesystem permissions.
Granted permissions.
Adding new service
New service added
Ended configuration step: Adjusting Windows service
Beginning configuration step: Initializing database (may take a long time)
Attempting to run MySQL Server with --initialize-insecure option...
Starting process for MySQL Server 5.7.29...
Starting process with command: C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --console --initialize-insecure=on --lower-case-table-names=1...
2020-02-14T10:43:06.401608Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-02-14T10:43:06.401673Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2020-02-14T10:43:06.408061Z 0 [ERROR] InnoDB: Unable to create temporary file; errno: 0
2020-02-14T10:43:06.408344Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-02-14T10:43:06.408444Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-02-14T10:43:06.408532Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-02-14T10:43:06.408617Z 0 [ERROR] Failed to initialize builtin plugins.
2020-02-14T10:43:06.408711Z 0 [ERROR] Aborting
Process for mysqld, with ID 15120, was run successfully and exited with code 1.
Failed to start process for MySQL Server 5.7.29.
Database initialization failed.
Ended configuration step: Initializing database (may take a long time)
anyone knows what's the problem?

Mysql Initializing Database error

Initializing Database Error
Error Log Beginning configuration step: Initializing Database
Attempting to run MySQL Server with --initialize-insecure option...
Starting process for MySQL Server 5.7.21...
Starting process with command: C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --console --initialize-insecure=on...
mysqld: Character set '0.0' is not a compiled character set and is not specified in the 'C:\Program Files\MySQL\MySQL Server 5.7\share\charsets\Index.xml' file
2018-04-02T09:44:47.468292Z 0 [Warning] option 'read_buffer_size': unsigned value 0 adjusted to 8192
2018-04-02T09:44:47.468337Z 0 [Warning] option 'read_rnd_buffer_size': unsigned value 0 adjusted to 1
2018-04-02T09:44:47.468371Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-02T09:44:47.468381Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2018-04-02T09:44:47.469610Z 0 [ERROR] Aborting
Process for mysqld, with ID 11812, was run successfully and exited with code 1.
Failed to start process for MySQL Server 5.7.21.
Database initialization failed.
Ended configuration step: Initializing Database
I got this issue when the selected port was already under use.
Changing the port (or stopping the existing service on that port) allowed me to continue from here.

Mysql server can not start as root

start mysql server as root failed.
1.service mysqld start
Starting mysqld: [FAILED]
2.mysqld
error log:
2016-02-23T01:19:16.961857Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-02-23T01:19:16.963350Z 0 [Note] mysqld (mysqld 5.7.10) starting as process 20924 ...
2016-02-23T01:19:16.965669Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2016-02-23T01:19:16.965715Z 0 [ERROR] Aborting
2016-02-23T01:19:16.965737Z 0 [Note] Binlog end
2016-02-23T01:19:16.965818Z 0 [Note] mysqld: Shutdown complete
but can start mysql service as mysql user, or use mysqld_safe as root can start too. what's wrong?
/etc/init.d/msyqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]
if ! /bin/kill -0 $safe_pid 2>/dev/null; then
echo "MySQL Daemon failed to start."
ret=1
break
fi
... ...
if [ $ret -eq 0 ]; then
action $"Starting $prog: " /bin/true
touch $lockfile
else
action $"Starting $prog: " /bin/false
fi
I found this Code Snippets in the script /etc/init.d/mysqld. but don't know why?
Add this line to /etc/my.cnf in [mysqld] section
explicit_defaults_for_timestamp = 1
Check this link
Since you can start as the mysql user, it is likely you have it currently configured to run as root.
Mysql's reference manual says:
On Linux, for installations performed using a MySQL repository, RPM packages, or Debian packages, the MySQL server mysqld should be started by the local mysql operating system user. Starting by another operating system user is not supported by the init scripts that are included as part of the installation.
/etc/selinux/config
#SELINUX=enforcing
SELINUX=disabled

MySQL does not start in XAMPP 1.7.3 for Windows

In 2000 I had installed XAMPP 1.7.3 on my Windows 7 64 Bit machine in F:/xampp. I always started the XAMPP Control Panel Application from this folder, clicked on the "Start" buttons for the MySQL and the Apache so it looked like this:
https://docs.moodle.org/19/de/images_de/e/e6/29_Apache_Stop-de.png
I recently decided to install the XAMPP 5.6.3 version to F:/xampp2. I imported another database and working on this new database was fine.
However, for some reason I cannot start the MySQL server in the F:/xampp any more. The Apache server does start. But when I click on the "Start" button in the XAMPP Control Center the text "Running" flashes up in green for a second (see linked picture above) and vanishes again. Nothing happens. In (this version 2.5.8 of) the Control Panel no additonal info is displayed in the log.
I tried everything to avoid a duplicate posting:
The other Mysql server in F:/xampp2 not running. The Port Check function of the Control Panel says 3306 is free.
Skype is not running.
There is no mysqld.exe in the Windows Task Manager
Checked services.msc - there is nothing running related to MySQL.
I ran netstat in a command line and there was no sign of 3306 anywhere.
I changed 3306 to 3307 in the f:/xampp/mysql/bin/my.ini. Nothing!
There are many threads like this one and I tried everything except to "delete and reinstall". I cannot delete F:/xampp - I have 500 GB and 500 tables of data in the F:/xampp MySQL database that my life depends on. I do not even want to touch the data in there and risk any loss. I cannot delete F:/xampp2 either. What can I do?
Thanks!
EDIT: I tried the following in the commandline:
f:\xampp\mysql\bin\mysqld.exe
150602 6:03:24 [Warning] Can't create test file \usr\local\mysql\data\MY-PC.lower-test
150602 6:03:24 [Warning] Can't create test file \usr\local\mysql\data\MY-PC.lower-test
f:\xampp\mysql\bin\mysqld.exe: Can't change dir to '\usr\local\\mysql\data\' (Errcode: 2)
150602 6:03:24 [ERROR] Aborting
150602 6:03:24 [Note] f:\xampp\mysql\bin\mysqld.exe: Shutdown complete
EDIT 2: I looked for the mysql.err file in f:\xampp\mysql\data.
150602 7:04:01 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: Error: log file \xampp\mysql\data\ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 1073741824 bytes!
150602 7:04:01 [ERROR] Plugin 'InnoDB' init function returned error.
150602 7:04:01 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150602 7:04:01 [ERROR] F:\xampp\mysql\bin\mysqld.exe: unknown variable 'innodb_file_format=barracuda'
150602 7:04:01 [ERROR] Aborting
150602 7:04:01 [Note] F:\xampp\mysql\bin\mysqld.exe: Shutdown complete
EDIT 3: Thanks for your comment, I tried the following but it there are other errors:
f:\xampp\mysql\bin\mysql --help
gives me inter alia:
Default options are read from the following files in the given order:
C:\Windows\my.ini C:\Windows\my.cnf C:\my.ini C:\my.cnf f:\xampp\mysql\my.ini f:\xampp\mysql\my.cnf
then i try this line and I know that the my.ini file is there:
f:\xampp\mysql\bin\mysqld.exe --defaults-extra-file=F:\xampp\mysql\bin\my.ini
150602 14:39:21 [ERROR] Can't find messagefile '\xampp\mysql\share\english\errmsg.sys'
150602 14:39:21 [Warning] Can't create test file \xampp\mysql\data\MY-PC.lower-test
150602 14:39:21 [Warning] Can't create test file \xampp\mysql\data\MY-PC.lower-test
f:\xampp\mysql\bin\mysqld.exe: Can't change dir to '\xampp\mysql\data\' (Errcode: 2)
150602 14:39:21 [ERROR] Aborting
Open a command prompt - press Win key + R and type in cmd.
In the command prompt type in F:\xampp\mysql\bin\mysqld.exe and press Enter. (note it is mysqld with a d in the end)
What do you see? There should be an error, possibly regarding your config file.
EDIT:
Try using:
F:\xampp\mysql\bin\mysqld.exe --defaults-extra-file=F:\path\to\config

Having issues starting MySQL Daemon

I'm new to the forums here but I hope to become more active as I've recently purchased a dedicated server and I'm running Fedora off of it so it's a constant learning process, I'm fairly average at BASH, but I know enough to make my way around, I'm a software developer to trade more than a network techi. Which leads me to my initial problem, I'm having an issue starting my MySQL daemon after rebooting my dedi, I have no clue why it's suddenly doing this, I'm running PHPMyAdmin from the server and also issuing certain commands through the CLI for MySQL, but after rebooting I'm getting this error everytime I try to start the instance of the daemon:
[root#ks23085 ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root#ks23085 ~]# systemctl mysqld start
Unknown operation mysqld
[root#ks23085 ~]# systemctl start mysqld
Failed to issue method call: Unit name mysqld is not valid.
[root#ks23085 ~]# systemctl start mysqld.service
[root#ks23085 ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/path/to/mysql.sock' (2)
It's completely bizarre as it was working perfectly before I rebooted it, I didn't update it or change the install, the only thing that I did do was install postfix, but I don't see why that would cause any issues with MySQL :S
I really need a hand on this one, I've tried several solutions from google with no results whatsoever. Thanks in advance guys.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Update 1:
Okay, so I found the directory that mysqld is held, it was '/usr/libexec/mysqld', I typed './mysqld start' in this directory and it specifies this output:
120729 1:49:09 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729 1:49:09 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729 1:49:09 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729 1:49:09 [Warning] Can't create test file /run/mysql/ks23085.lower-test
./mysqld: Can't change dir to '/run/mysql/' (Errcode: 2)
120729 1:49:09 [ERROR] Aborting
120729 1:49:09 [Note] ./mysqld: Shutdown complete
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Update 2:
I managed to get passed the directory issue by creating the 'mysql' directory in 'run/' with all my old databases, but now I seem to be getting an error that doesn't seem to be as easy to fix :/
Here's the output:
120729 2:15:59 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729 2:15:59 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
120729 2:15:59 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729 2:15:59 [Warning] Can't create test file /run/mysql/ks23085.lower-test
120729 2:15:59 [Note] Plugin 'FEDERATED' is disabled.
120729 2:15:59 [Note] Plugin 'InnoDB' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
120729 2:15:59 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120729 2:15:59 [ERROR] mysqld: unknown option '--skip-locking'
120729 2:15:59 [ERROR] Aborting
120729 2:15:59 [Note] mysqld: Shutdown complete
The official doc states that there's 2 possible reasons for this error:
You don't have permissions to access the directory /var/lib/mysql/whatever.sock because mysql is the owner of the folder
or
/path/whatever.sock doesn't exist.
Execute the following to find your socket:
mysqladmin variables | grep socket
Added to configuration file as suggested:
You can try this though [Linux specific, but what other operating
systems are there?] Go to /etc/my.cnf and change/add the lines:
[mysqld]
datadir=/var/lib/mysql
socket=/tmp/mysql.sock
[client]
socket=/tmp/mysql.sock
2) Don't forget to check your permissions!