My EC2 instance ran out of space so followed directions to backup and restore to a larger volume. After I did that, I couldn't start up MySQL anymore.
When I try to start MySQL on my EC2 instance with Bitnami, it just hangs there. It looks like it's because I don't have a socket file at all where it should be /opt/bitnami/mysql/tmp/mysql.sock. Instead I just have a lock file there (/opt/bitnami/mysql/tmp/mysql.sock.lock).
One source I found said to recreate a symlink to another .sock file but I think because it's Bitnami it's in a different location and I'm not sure where that is.
Of course, it's possible that this sock file is just a red herring so I'm also digging into other possible causes. Has anyone else had this happen before? It seems like a problem that could be common but I haven't been able to find much about this aside from the vanilla Bitnami docs.
If you look at the MySQL script that Bitnami has (found at /opt/bitnami/mysql/scripts/ctl.sh) you can see that the MySQL log file is located at /opt/bitnami/mysql/data/mysqld.log on Bitnami instances. Look at the most recent logs, mine showed the following toward the end of the logs:
[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): 'x.x.x.x'; port: xxxx
[Note] - 'xxx.x.x.x' resolves to 'xxx.x.x.x';
[Note] Server socket created on IP: 'xxx.x.x.x'.
[ERROR] Unix socket lock file is empty /opt/bitnami/mysql/tmp/mysql.sock.lock.
[ERROR] Unable to setup unix socket lock file.
[ERROR] Aborting
Originally I thought the SSL thing was the issue but someone else pointed out that this is just a warning.
Ultimately I was able to fix this by just backing up the lock file (just in case) and then removing it:
# Back that thang up
sudo cp /opt/bitnami/mysql/tmp/mysql.sock.lock /opt/bitnami/mysql/tmp/mysql.sock.lock.backup
# Remove it
sudo rm /opt/bitnami/mysql/tmp/mysql.sock.lock
# Fire it up again
sudo /opt/bitnami/ctlscript.sh start mysql
I need to run a query to populate a memory table on every MySQL start.
Is there any way to do this?
MySQL is able to read statements from init_file on startup.
You'd have to place the following in my.ini or my.cnf (depending on the OS) file
[mysqld]
init-file="/path/to/your/query/populate_memory_table.sql"
Another option is to have a system script run after mysql starts. With systemd in Linux, the following would work:
cat > /lib/systemd/system/mysql-preload.service << END
[Unit]
Description=Pre-Load MEMORY tables after MySQL starts
PartOf=mysql.service
After=mysql.service
[Service]
Type=oneshot
ExecStart=/home/myuser/script.sh
[Install]
WantedBy=multi-user.target
END
systemctl daemon-reload
The script will be run the next time mysql starts or restarts. Not quite as good as init_file because mysql will be available for queries before the MEMORY tables have been populated, but much more flexible.
i have been spending hours figuring out problems in connection mysql to use mariadb eventually. here's a situation.
situation:
1.i use macbook, and i am not that familiar with computer programming.
i tried to connect java eclipse and mariadb. so i looked it up online.
and at the same time, i opened up terminal and started my mysql using
mysql.server start
and it worked. and i was supposed to download mariaddb.2.2 jar something to connect it with eclipse, but i mistakenly downloaded "mariadb-10.2.12-osx10.13-x86_64.pkg" and installed it. and i also typed
mysql.server stop
and all that kind of things. lots and lots of things so that i can`t even remember
after i found out i downloaded the wrong things, i felt like this is way beyond my skills, so i jumped back to play with mariadb.
i opened up terminal and typed
mysql.server start
and termial keeps showing me this until now
.180322 00:04:47 mysqld_safe Logging to '/usr/local/var/mysql/sinjinhos-MacBook-Air-146.local.err'.
180322 00:04:47 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
. ERROR!
i still think that this tragedy started beacause i installed mariadb again...
i literally tried everything and still couldn`t figure it out.
please help me!!
From your initial post you can see that mariadb is logging the following file.
180322 00:04:47 mysqld_safe Logging to '/usr/local/var/mysql/sinjinhos-MacBook-Air-146.local.err'
Inside that file you found the following error.
2018-03-22 0:36:36 140736284734272 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 48: Address already in use 2018-03-22 0:36:36 140736284734272 [ERROR] Do you already have another mysqld server running on port: 3306 ? 2018-03-22 0:36:36 140736284734272 [ERROR] Aborting
The key part of the error is Address already in use. Everything running on your computer that listens for connections (like a database or a web server) will listen on a specific port. MySQL (and therefore MariaDB) listens on port 3306 by default. The important part is that you can't have multiple applications listening on the same port!
So where do you go from here? I suspect you still have MySQL running on your laptop, and once you stop it you will be able to start up a new instance.
To check if MySQL is running you can use the following command:
ps -ef | grep mysql
If anything shows here then it is running, and you should stop the service. How you do this will vary depending on how you installed it - try mysql.server stop first and run the above command again. If it is still running and you can't figure it out then you can kill the service. This is not recommended and cause MySQL data corruption - although if you have no data there then you should be OK.
Example output of ps -ef. Yours should show MySQL near the end, and the second column shows the process ID which you can use to kill the process.
PID
\/
0 9504 9491 0 3:44pm ttys007 0:00.00 ps -ef`
So I would use:
kill 9504
You should then be able to start the service again.
mysql.server start
I'm attempting to script the creation of a machine image that includes MySQL with some seed data.
I'm looking for a way to start the MySQL database engine, run a .sql script to create the data, and then shutdown the engine. Is there a best way to do this?
It looks like I could use the --init-file argument of mysqld to launch mysql and run the script, but how would I cause the database engine to shutdown after the script completes?
I'm on Ubuntu if it matters.
Just do these three commands in one script:
service mysql start
mysql -umyuser -pmypass < /path/to/your/startup.sql
service mysql stop
You may consider using skip-networking in your /etc/mysql/my.cnf file so that the database is not accidentally accessed by anyone else for the short perios when it's up and running. In which case add the --socket argument to your mysql client command.
I have a problem with my XAMPP server. I can start Apache, FileZilla, and every thing else without problems, but when I try to start MySQL, it just says
Attempting to start MySQL service...
and it stays like that forever, like if it was frozen or something.
Any ideas how to fix it?
I fetch the problem to start xampp services "mysqld.exe: Aria recovery failed. Please run aria_chk -r on all Aria tables and delete all aria_log.######## files"
I delete all area_log files form xampp\mysql\data
after that I restart XAMPP than it works.
Thanks
Check the log files for MySQL. You will find them in this directory:
C:\xampp\mysql\data (assuming standard install location of xampp)
Also check if no other program or service uses the default MySql port.
You can do this by using this command:
netstat -an | findstr "3306"
If anything shows up the default mysql port is in use.
In Windows, you should go: Start > Run > services.msc > Apache 2.4 > Properties > Start Mode > Automatic > Apply > Start > OK > [Same as MySQL]
I was not able to start Mysql on xampp.
Error message was:-
Aria recovery failed. Please run aria_chk -r on all Aria tables and
delete all aria_log.######## files. Plugin 'Aria' init function
returned error. Plugin 'Aria' registration as a STORAGE ENGINE failed.
Plugin 'FEEDBACK' is disabled. Aria engine is not enabled or did not
start. The Aria engine must be enabled to continue as mysqld was
configured with --with-aria-tmp-tables. Aborting.
Just to go xampp/mysql/data and delete or remove the file related to aria_log and restart your xampp server.
Worked fine for me.
Resolve the issue stopping the mysql process in the activity monitor and then restarting the mysql server from within the xampp UI.
Go to the error log and check. For me I got this error message:
InnoDB: Error: could not open single-table tablespace file .\mysql\innodb_index_stats.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
So what I did was I went to the mysql folder and deleted the data1idb file. After that it worked fine. The problem started when I installed Drupal.
Perform
which mysql.server
sudo path/to/mysql.server start
This should work on *nix OS
eg sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start for mac osx
In The xampp folder you should find the start mysql batch file. Run it, The firewall might ask if you want to allow it through ( So check your firewall if it lets mysqld.exe through )
OP did not provide enough information, however this (and other errors) can be caused by the default MySQL port (3306) being used. If this is the case, you can solve it like this:Go to: XAMPP Control Panel -> MySQL: "Config" button -> my.ini Change the port number from 3306 to a different valid port number. I just used 3307.You can find out more information about your problem by looking at the error log file. This is found here: XAMPP Control Panel -> MySQL: "Logs" button -> mysql_error.log
Running the "setup_xampp.bat" file located in the root directory of Xampp did the trick for me.
Though this is late, I'm sure it would help someone in future.
First run which mysql.server to know where mysql is located on your machine. After then run sudo /usr/local/bin/mysql.server stopto be sure that no other mysql process is running. If no other process is running, you would definitely get an error saying MySQL server PID file could not be found!. That's fine.
After then run sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start to start Xampp's mysql server. When you go to the Xampp GUI, you should see that mysql status as running.
Please note that this is for OS X users.
I face same issue. I installed xampp in D drive.
I uninstall and install setup as run as administrator. Again face same issue.
I searched and try lot of suggestion but no luck.
I solve the problem by right click on xampp and open as Administrator and xampp start working fine.
I was not able to start MySQL service. When I checked mysql log it said:
[ERROR] mysqld: File 'C:\xampp\mysql\data\aria_log_control' not found (Errcode: 13 "Permission denied")
[ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file 'C:\xampp\mysql\data\aria_log_control'
I checked suggested location in the log and file was present.
I found I was doing silly mistake, Since UAC is activated in my PC, I had to start XAMPP using "Run As Administrator".
It worked fine for me.