MySQL 5.1 exit code documentation? - mysql

Can someone point me at the docs for the termination codes for MySQL 5.1?
I have a MySQL 5.1.41 installation on an Ubuntu server that seems to be crashing about every 90 seconds with the following message in syslog:
init: mysql main precess terminated with status 2
init: mysql main process ended, respawning
Googling for MySQL and "termination code", "termination status", "exit code", or "exit status" yields nothing useful. Apparently MySQL docs call this something different than what init is reporting.
Anyone have a guess?

You'll want to look at the
/var/log/mysql.err
file for more information on why it's crashing. Replace machinename with the hostname of your computer.
UPDATE: I changed the .err file path. It should be correct now. It's based on information found here. It seems to correspond with a file on my Ubuntu installation. Although on my machine, the file is empty.

Related

How to fix "too many open files" in MySQL?

I am very frequently getting this error in MySQL:
OS errno 24 - Too many open files
What's the cause and what are the solutions?
I was getting the errno: 24 - Too many open files too often when i was using many databases at the same time.
Solution
ensure that the connections to db server close propertly
edit /etc/systemd/system.conf. Uncomment and make
DefaultLimitNOFILE=infinity
DefaultLimitMEMLOCK=infinity
then run systemctl daemon-reload and service mysql restart.
You can check the results with the query: SHOW GLOBAL VARIABLES LIKE 'open_files_limit' and you may notice that the value has changed. You should not have any errno 24 now.
Please notice that the solution may differ from other OS/versions. You can try to locate the variables first.Tested with Ubuntu 16.04.3 and mysql 5.7.19.
In my case it was useless to setting up the open_files_limit variable in mysql configuration files as the variable is flagged as a readonly.
I hope it helped!
You probably have a connection leak in your application, that is why open connections are not closed once the function completes it's execution.
I would probably look into the application code and see where the connections/preparedstatement (if it's java) objects are not closed and fix it.
A quick workaround is to increase ulimit of the server (explained here) which would increase number of open file descriptors (i.e. connections). However, if you have a connection leak, you will encounter this error again, at later stages.
I faced the same problem and found a solution on another stackoverflow-question.
By running the following snippet with Bash:
ulimit -n 30000

Can't get MySQL to start

I can't get my MySQL Sever to start. It had been running fine for a month or so since the install, but after a reboot yesterday, it will not start. I have tried a number of recommendations from other posts here, but no luck.
This install worked fine until the reboot. According to Activity Monitor I do have one mysqld process running.
I get this error from:
mysql -u root
"ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)"
I get this error when running:
sudo /usr/local/mysql/support-files/mysql.server start
"ERROR! The server quit without updating PID file (/usr/local/mysql/data/laptop.pid)."
Also the MySQL prerPane shows the Server Status stopped. Clicking the "Start MySQL Server" brings the spinning ball and doesn't start the server.
I don't want to uninstall and reinstall.
I'm running 10.9.6 OSX and what seems to be mysql-5.6.22-osx10.8-x86_64. (even though I also have a directory for mysql-5.7.10-osx10.9-x86_64 in my /usr/local/ directory). My install is from the Pkg file from the MySQL website.
Any suggestions would be welcome.
Card-carrying OS/X user here . . .
Start by firing up the Console utility and using it to examine the logs in /var/log/apache2. (Use File..Open.. within the utility.)
I'm a little bit uncomfortable about your actual boots-on-the-ground situation because you indicate that you have installed a version that is different from the one that Apple provides. (How did it work, before?) Apple's utilities can only be expected to know about Apple's expected tools.
(Incidentally, the latest OS/X, "El Capitan," is running 5.7.11 as "the official, Apple-installed version.")

Mysql Service doesnt show but can login and is running

OK something odd and maybe im missing something simple here. I am trying to diagnose a problem I think that max connections are being reached and need to up them. Upon further looking I ran # service --status-all and then I noticed that mysqld was not in the list so I tried service mysqld status which returned mysqld: unrecognized service . but if I run mysql - p MYPASS I am logged in to mysql and can see all my databases as normal. also I log into phpmyadmin just fine all databases are there. Also have several scripts running using 'localhost' and my mysqlusername and pass, and they are running just fine...
So I am not sure why I am not seeing the mysql service, anyone have some idea? or can point me in some direction?
I am using Centos, I did not set this machine up that person is no longer here, I have several other servers running mysql as well and I checked all those all is right.
It sounds like the service has not been registered.
On a working box do;
chkconfig --list mysqld it should return something like;
mysqld 0:off 1:off 2:off 3:on 4:off 5:off 6:off
Now do the same on the box in question - if nothing comes back then you need to chkconfig --add mysqld then re run the above commands to verify its registered, then you should be able to access it via the service manager.

Xampp Linux: PDOException: SQLSTATE[HY000] [2002] Connection refused in lock_may_be_available() error

I have been struggling to find a solution for this issue with MySQL. Things changed after I placed a ojdbc jar file on Apache Solr tomcat server. Since then i have been getting this error. It seems there is yet another mysql instance running on the machine.
Xampp Status shows MySQL Database is deactivated. I have been searching for a working solution since this morning but no luck. Your help is very much appreciated.
PS: /opt/lampp/lampp status says mysql is 'running'. When stopped, it reads 'OK' but when starting it again, it says 'already running'....and the Xampp Status page says MySQL database is Deactivated
The command /opt/lampp/lampp status basically goes and check for the pid file
MYSQL_PIDFILE=/opt/lampp/var/mysql/$HOSTNAME.pid
Sometimes this PID file get corrupted (in case of a crash, or procees kill).
In such scenario, the status command will tell you that the mysql is running, where as there is no process that exists for that PID file and the XAMPP status which shows in the browser will not be able to connect to the server (because it is not running) and hence come as deactivated.
Just rename the pid file as $HOSTNAME_bkp.pid or something like that and restart lampp, the issue will get resolved.

MySQL Server does not start after changing max_allowed_packet parameter

MySQL Community Edition 8.0.13 on Windows 10 Pro 32 GB x64
I am running the community server 8.0.18 (from the command line and not the service) and I need to set the max_allowed_packet value to higher than the default.
However,the server hangs on start with max_allowed_packet=16M, both when
change is made in the ini file, or
the value is passed as a command line parameter
Update:It seemed strange that the server would not start after a legal change - so I just saved the conf (my.ini) file without making any changes. And the got the same result
The ini file is as follows:
# The maximum size of one packet or any generated or intermediate string, or any parameter sent by the
# mysql_stmt_send_long_data() C API function.
max_allowed_packet=16M
The steps I followed are:
Install MySQL with advance logging and turn on all logs and without setting up a service
Start server by running mysqld : starts ok
Stop server by running mysqladmin -u root -p shutdown : shutsdown ok
change the value in the my.ini
Start server - server hangs
Full logging is on but nothing even gets written to the log. The last entry in the log is:
2019-10-24T14:47:56.916731Z 10 Connect root#localhost on using SSL/TLS
2019-10-24T14:47:56.916973Z 10 Query shutdown
2019-10-24T14:47:56.917224Z 10 Query
At this point, the only thing possible is to reboot, uninstall and then install again.
I have searched the forum for similar issues, and none of the previous suggestions apply/or work.
Issues resolved: Am posting an answer instead of deleting the question just in case it helps somebody else.
I had the conf (ini) file open in an editor (sublime/atom at different times) while I was starting the server. Finally I used notepad edited the file, closed it and the server started just fine.
I think the server is not able to load the conf file if it is open by another process.