MariaDB/MySQL resource limit was exceeded - mysql

I'm trying to connect to MariaDB/Mysql installed on my CentOS 7 and get the following error when trying to connect using: mysql -u root -p.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
I have tried connecting to it by specifying the IP Address instead of using localhost but I get the same error.
When I try to get the MariaDB status, I get the following message (/bin/systemctl status mariadb.service):
mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: failed (Result: resources)
And starting it yields the following error (/bin/systemctl start mariadb.service):
Job for mariadb.service failed because a configured resource limit was exceeded. See "systemctl status mariadb.service" and "journalctl -xe" for details.
I also looked into the logs located at /var/log/mariadb/mariadb.log
160408 12:21:00 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
160408 16:11:01 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160408 16:11:01 [Note] /usr/libexec/mysqld (mysqld 5.5.47-MariaDB) starting as process 3054 ...
160408 16:11:02 InnoDB: The InnoDB memory heap is disabled
160408 16:11:02 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160408 16:11:02 InnoDB: Compressed tables use zlib 1.2.7
160408 16:11:02 InnoDB: Using Linux native AIO
160408 16:11:02 InnoDB: Initializing buffer pool, size = 128.0M
160408 16:11:02 InnoDB: Completed initialization of buffer pool
160408 16:11:02 InnoDB: highest supported file format is Barracuda.
160408 16:11:04 InnoDB: Waiting for the background threads to start
160408 16:11:05 Percona XtraDB (http://www.percona.com) 5.5.46-MariaDB-37.6 started; log sequence number 54018416776
160408 16:11:06 [Note] Plugin 'FEEDBACK' is disabled.
160408 16:11:07 [Note] Server socket created on IP: '0.0.0.0'.
160408 16:11:07 [Note] Event Scheduler: Loaded 0 events
160408 16:11:07 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.47-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
160409 6:26:06 InnoDB: Error: Write to file ./ibdata1 failed at offset 9 615514112.
InnoDB: 1048576 bytes should have been written, only 585728 were written.
InnoDB: Operating system error number 28.
InnoDB: Check that your OS and file system support files of this size.
InnoDB: Check also that the disk is not full or a disk quota exceeded.
InnoDB: Error number 28 means 'No space left on device'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html
160409 6:26:06 InnoDB: Assertion failure in thread 140463216400128 in file os0file.c line 4377
Anyone has any ideas on how to fix this error?
Thank you :)

> perror 28
OS error code 28: No space left on device
Need I say more?

Related

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)

Why MySQL Restarted When Number of Processes Running Now 0

Some background. I hosted a WordPress site in VPS and sometimes MYSQL down with error "Error Establishing a Database Connection". I've spent some time to research and believe the problem is due to when MySQL get restarted, it is not able to allocate enough RAM to proceed.
I believe I can improve the situation by increasing physical RAM or swap. But my question for this post is, why MySQL need to restart itself? My site is with pretty low traffic and doesn't seem like the DB is corrupted.
Below is the full log for this issue:
160103 18:39:54 mysqld_safe Number of processes running now: 0
160103 18:39:54 mysqld_safe mysqld restarted
160103 18:39:55 [Note] /usr/libexec/mysqld (mysqld 5.5.44-MariaDB) starting as process 22061 ...
160103 18:39:55 InnoDB: The InnoDB memory heap is disabled
160103 18:39:55 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160103 18:39:55 InnoDB: Compressed tables use zlib 1.2.7
160103 18:39:55 InnoDB: Using Linux native AIO
160103 18:39:55 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
160103 18:39:55 InnoDB: Completed initialization of buffer pool
160103 18:39:55 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160103 18:39:56 [ERROR] Plugin 'InnoDB' init function returned error.
160103 18:39:56 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160103 18:39:56 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
160103 18:39:56 [ERROR] mysqld: Out of memory (Needed 96681984 bytes)
160103 18:39:56 [ERROR] mysqld: Out of memory (Needed 72499200 bytes)
160103 18:39:56 [Note] Plugin 'FEEDBACK' is disabled.
160103 18:39:56 [ERROR] Unknown/unsupported storage engine: InnoDB
160103 18:39:56 [ERROR] Aborting
When Number of Processes Running Now 0 means that MySQL isn't running. So the daemon mysqld_safe "makes you a favor" and start MySQL
You have assigned very low RAM 128MB to innodb_buffer_pool_size (which is default RAM). So you should assign approx. 80% of total RAM to this variable if you are using innodb engine, as mysql uses intially memory from this variable to cache index as well data in innodb engine.
So update at least 1 GB RAM (should be 80% of total ram for innodb) to innodb_buffer_pool_size in your config file and restart mysql service.
Update:
You have 1 GB RAM: You can assign 800M RAM (or >=500M) to innodb_buffer_pool_size.
MySQL will auto restart when number of running process 0: As per errors shared by you...this error is coming at the time of mysql service start and server is not able to initiate mysql service with such a less RAM.
160103 18:39:55 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
160103 18:39:55 InnoDB: Completed initialization of buffer pool
160103 18:39:55 InnoDB: Fatal error: cannot allocate memory for the buffer pool
I had a similar problem with MySQL on CentOS 6.9. It was caused by memory starving due another PHP process and not by MySQL. MySQL was just a victim.
You can look at kernel messages. The location of this messages may be specific to OS. In case of CentOS 6.x they are located in /var/log/messages .
Here are some related messages from /var/log/messages:
Jul 25 20:34:46 myserver kernel: Out of memory: Kill process 21467 (mysqld) score 30 or sacrifice child
Jul 25 20:34:46 myserver kernel: Killed process 21467, UID 497, (mysqld) total-vm:757004kB, anon-rss:17728kB, file-rss:320kB
You can run the following command to see if kernel run out of memory:
cat /var/log/messages | grep out_of_memory

Error 1067: The process terminated unexpectedly when trying to start MySQL

I have WAMP server version 2.2. Previously, MySQL Server running normally.
I don't know why when I tried to start, it cannot start anymore.
Here are the content of MySQL.log:
140502 21:04:46 [Note] Plugin 'FEDERATED' is disabled.
140502 21:04:47 InnoDB: The InnoDB memory heap is disabled
140502 21:04:47 InnoDB: Mutexes and rw_locks use Windows interlocked functions
140502 21:04:47 InnoDB: Compressed tables use zlib 1.2.3
140502 21:04:47 InnoDB: Initializing buffer pool, size = 128.0M
140502 21:04:47 InnoDB: Completed initialization of buffer pool
140502 21:04:47 InnoDB: highest supported file format is Barracuda.
140502 21:04:47 InnoDB: Waiting for the background threads to start
140502 21:04:48 InnoDB: 1.1.8 started; log sequence number 1595675
140502 21:04:48 [Note] Server hostname (bind-address): '(null)'; port: 3306
140502 21:04:48 [Note] - '(null)' resolves to '::';
140502 21:04:48 [Note] - '(null)' resolves to '0.0.0.0';
140502 21:04:48 [Note] Server socket created on IP: '0.0.0.0'.
140502 21:04:48 [ERROR] Can't start server: Bind on TCP/IP port: No such file or directory
140502 21:04:48 [ERROR] Do you already have another mysqld server running on port: 3306 ?
140502 21:04:48 [ERROR] Aborting
140502 21:04:48 InnoDB: Starting shutdown...
140502 21:04:49 InnoDB: Shutdown completed; log sequence number 1595675
140502 21:04:49 [Note] wampmysqld: Shutdown complete
I had already tried to reinstall WAMP server but appear the same error.
Can someone help me, please...
It's possible that the port is trying to be opened by another storage engine than InnoDB. Refer to this article for some commands that can help you identify what's happening.
For instance, netstat -an | findstr "3306"
danielschneller.com/2007/10/cant-start-server-bind-on-tcpip-port-no.html
Something is already working on that port. In administrator CMD console write
netstat -abn
and find port 3306, then you will know what is blocking the port (what is already running on it and blocks your mysql).
If that doesnt help you then check my.ini settings
In that file search for
socket = /something
and change that to
socket = c:/something
I had the same problem with Windows 7 32-bit.
Cause
Some filenames are reserved by Windows, such as ${machinename}.pid, ${machinename}.err, etc.
MySQL uses some of these filenames by default.
Solution
After the installation is complete, during the configuration phase, there's an Advanced option using which you can change these filenames. You can change the log file names but not the pid file name.
You need to step through the configuration wizard to the "starting service" step, and then it will throw an error/warning message. Leave the wizard paused (do not stop/cancel the wizard).
By now, your my.ini file has been created. You can add the following variable
pid_file=/path/to/pid/file.pid
Then go to Windows Services and start the service.
N.B. DO NOT STOP/CANCEL THE WIZARD.
Once the service is started, the wizard will continue, and will configure MySQL properly.
setting file my.ini :
innodb_flush_method=normal

MySQL doesn't display errors in error log

After having some trouble with installing a UDF in MySQL (Cannot install MySQL UDF) I'm facing another issue. When executing the function I get a "Lost connection to MySQL server during query" error (errno 2013). Error logging is enabled, but I can't see any error messages in the log file. The my.ini configuration file has the following log properties under mysqld:
log-output=FILE
general-log=0
general_log_file="mysql-general-log-file.log"
slow-query-log=1
slow_query_log_file="mysql-slow-query-log-file.log"
long_query_time=10
log="mysql.log"
# Error Logging.
log-error="mysql-error.log"
log-warnings=2
And here is the mysql-error.log output:
140314 21:29:25 [Note] Plugin 'FEDERATED' is disabled.
140314 21:29:25 InnoDB: The InnoDB memory heap is disabled
140314 21:29:25 InnoDB: Mutexes and rw_locks use Windows interlocked functions
140314 21:29:25 InnoDB: Compressed tables use zlib 1.2.3
140314 21:29:25 InnoDB: Initializing buffer pool, size = 307.0M
140314 21:29:25 InnoDB: Completed initialization of buffer pool
140314 21:29:25 InnoDB: highest supported file format is Barracuda.
140314 21:29:26 InnoDB: Waiting for the background threads to start
140314 21:29:27 InnoDB: 5.5.32 started; log sequence number 9975593
140314 21:29:27 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
140314 21:29:27 [Note] - '0.0.0.0' resolves to '0.0.0.0';
140314 21:29:27 [Note] Server socket created on IP: '0.0.0.0'.
140314 21:29:27 [Note] Event Scheduler: Loaded 0 events
140314 21:29:27 [Note] C:/Program Files/MySQL/MySQL Server 5.5/bin\mysqld: ready for connections.
Version: '5.5.32-log' socket: '' port: 3306 MySQL Community Server (GPL)
I've also tried to debug the UDF itself by adding a few print commands to the code, e.g.
fprintf(stderr, "%s", "Launching JVM\n");
fflush(stderr);
Unfortunately this didn't work either. Which other options do I have to track down the issue?

Trouble launching mysql

I have some trouble using mysql on Ubuntu 12.04. I hope this post is in the right forum (if not, tell me where to move it)
When I run : sudo /etc/init.d/mysql, I get this message
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start mysql
start: Job failed to start
When I run mysql -u root status, I get this
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
So I tried to kill the process, so I ran ps aux | grep mysql showing this
1000 3262 0.0 0.0 4388 832 pts/1 S+ 14:05 0:00 grep --color=auto mysqld
And when I run the kill command, I get this :
kill: No such process
When I launch sudo mysqld --verbose
[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.
121122 14:50:24 [ERROR] An old style --language value with language specific part detected: /usr/share/mysql/french/
121122 14:50:24 [ERROR] Use --lc-messages-dir without language specific part instead.
121122 14:50:24 [Note] Plugin 'FEDERATED' is disabled.
121122 14:50:24 InnoDB: The InnoDB memory heap is disabled
121122 14:50:24 InnoDB: Mutexes and rw_locks use GCC atomic builtins
121122 14:50:24 InnoDB: Compressed tables use zlib 1.2.3.4
121122 14:50:24 InnoDB: Initializing buffer pool, size = 128.0M
121122 14:50:24 InnoDB: Completed initialization of buffer pool
121122 14:50:24 InnoDB: highest supported file format is Barracuda.
121122 14:50:24 InnoDB: Waiting for the background threads to start
121122 14:50:25 InnoDB: 1.1.8 started; log sequence number 2289875
121122 14:50:25 [ERROR] mysqld: unknown variable 'default-character-set=utf8'
121122 14:50:25 [ERROR] Aborting
121122 14:50:25 InnoDB: Starting shutdown...
121122 14:50:26 InnoDB: Shutdown completed; log sequence number 2289875
121122 14:50:26 [Note] mysqld: ArrĂȘt du serveur terminĂ©
Could someone please help
With the command "mysql", what you're trying to do is launch the mysql client.
Mysql client must connect to a server.
You should start mysql server, like Jeremy suggested, or using
sudo start mysql
See here for more information
https://askubuntu.com/questions/125686/mysql-fails-to-start-after-upgrade-to-12-04