MySQL won't start on Bitnami EC2 instance - mysql

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

Related

MAMP Pro and MySQL having Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root

After updating to macOS Catalina I’m not able to run MySQL with MAMP Pro.
I get an error. Here from mysql_error.log
2019-10-09T10:53:16.6NZ mysqld_safe Logging to '/Applications/MAMP/logs/mysql_error.log'.
2019-10-09T10:53:16.6NZ mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql57
2019-10-09T10:53:16.917470Z 0 [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.
2019-10-09T10:53:16.919285Z 0 [Note] /Applications/MAMP/Library/bin/mysqld (mysqld 5.7.26) starting as process 3320 ...
2019-10-09T10:53:16.932570Z 0 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql57/ is case insensitive
2019-10-09T10:53:16.932669Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2019-10-09T10:53:16.932697Z 0 [ERROR] Aborting
2019-10-09T10:53:16.932751Z 0 [Note] Binlog end
2019-10-09T10:53:16.935298Z 0 [Note] /Applications/MAMP/Library/bin/mysqld: Shutdown complete
2019-10-09T10:53:16.6NZ mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
I was searching the interenet and i’ve already tried a lot, but i can’t get it running.
Anyone experienced the same problem and could help?
Thx in advance!
I have a temporary fix, until the developers release a fix. I am using MAMP Pro; I don't know if the interface is the same in non-Pro. The temp fix:
Open MAMP Pro. Stop servers if they are running. Open the MySQL template from the menu: File > Edit Template > MySQL (mysql.cnf) > 5.7.26
Scroll down or find [client]. Beneath [client] add the following line:
user = root
Scroll down or find [mysqld]. Beneath [mysqld] add the following line:
user = root
Start servers.
This worked for me. Hope it helps you.
I had the same problem after installing Catalina on my Mac. First I have tried solution of Les Brown. Did not completely work for me. I got another error:
[Note] Access denied for user 'root'#'localhost' (using password: NO)
After some reading I saw a video on youtube (https://www.youtube.com/watch?v=LKE1G4sinBM) which lets you add the keyword skip-grant-tables in the section mysqld of the MySql template of MAMP-PRO. That let mysql working, but is not the best idea to have forever in your template file. If your try to add the line, do not forget to remove it also!
Last but not least I got the hint of MAMP-Pro-support to make a symbolic link to the mysql.stock. So I executed in Terminal (the '$' is the prompt of terminal).
$ sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
Password:...
$
Now everything is working fine.
The answer from Les Brown helped me. I have one addition that may apply to you and others.
If MAMP (PRO) is accessing any directories in Documents or iCloud Drive, Catalina requires the user to approve MAMP's and/or MYSQL's access to that directory.
For instance, on one of my MAMP PRO servers, I run an ETL (using cron) that downloads csv files from a website, then loads data from each downloaded csv into specified MySQL tables in my testing database. The script wouldn't work, however, because MySQL did not have permission to access the downloaded csv files from the Documents directory. I had to run manually my ETL script from the command line. At that point, a MacOS modal popped up directing me to grant permission for MySQL to access Documents. Once I granted that permission, the ETL scripts began working.

fail to start mysql(mariadb)

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

MacOS Can't start MySQL Server

I have MacOS Sierra. I have installed MySQL Server which has been working, however, after a reboot of the Mac Book, I cannot start the MySQL Server.
I have tried changing the port from 3306 to 3307 in the my.cnf file.
Question
I would appreciate any help on how to start the MySQL Server, and also have it so it starts automatically on MacOS Boot up.
(I am new to Mac, so apologies if this is a basic question).
UPDATE
Looking for error logs, I can't find anything with todays (2/2/2017) timestamp.
Nothing in the data dir:
No files with "mysql" have been modified since I've tried to start the MySQL Server (2/2/2017 after 09:00).
I suggest using Terminal commands.
Start MySQL
sudo /usr/local/mysql/support-files/mysql.server start
Stop MySQL
sudo /usr/local/mysql/support-files/mysql.server stop
Restart MySQL
sudo /usr/local/mysql/support-files/mysql.server restart
In my case, I had inadvertently transferred ownership of entire /usr/local directory to myself, which resulted in snatching-away of write permission of /usr/local/mysql-5.7.20-macos10.12-x86_64/data directory from the daemon user called "_mysql".
Restoring the ownership fixed the issue.
After a discussion with Richard, the following solves the issue:
my.cnf:
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
datadir = /usr/local/mysql-5.7.17-macos10.12-x86_64/data
tmpdir = /tmp
Essentially, although we'd added the relevant stanza's to the my.cnf file, we'd still missed the section heading. Adding the [mysqld] section allowed mysql to start.
After installing Mysql 8.0.12 on MacOS High Sierra, Mysql server would not start up. I tried several suggestions like removing mysql and reinstalling it, rebooting the computer and changing file permissions, all to no avail. I finally got it to work by removing /etc/my.cnf.
In my case, ownership of the msyql directory had somehow changed to admin:admin. I use ares suggestion to run mysqld from the terminal:
sudo /usr/local/mysql/support-files/mysql.server start
Which showed a permissions error writing to a msyql file.
I fixed with this command:
sudo chown -R _mysql:wheel /usr/local/mysql/data
from this post:
What user should own /usr/local/mysql on Mac?
In my case, First time, after installing Mysql, Mac needs a restart.
So restarting Mac, after installation, fixed the issue for me.
MacOS doesn't come with a my.cnf file. Default settings will suffice the needs for basic usage. Once we need to override them, it makes sense to have a custom configurations.
This solution works for me.
You have to open the activity monitor up and search for mysqld service. Once selected, just click the delete button located in the up left part and you will see the memory goes down. After that, you can verify your mysql server status from System Preferences and the service is up.
With this solution you don't have to restart your machine and get to work fast.
My problem was that due to an incorrect restart of my machine, a database was corrupted. According to their docs doing a forced InnoDB Recovery did the trick:
/etc/my.cnf
innodb_force_recovery = 2
My problem was that I installed MySQL a while ago with Homebrew (forgot I did) and then went the more manual route, so I think the two installs were fighting each other. I wiped my Mac of both with the help of this walkthrough: https://gist.github.com/vitorbritto/0555879fe4414d18569d
Note: Where it says to use subl - that's Sublime, use whatever editor you like.
I was able to get things to work with a fresh install after that.
I had this same issue on Monterey. Make sure you're selecting the correct download according to your processor architecture.
I ran into same problem with following .err log.
MacOS: Catalina 10.15.7.
MySQL version: 5.7.19.
2021-08-19T02:17:26.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2021-08-19T02:17:27.303813Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-08-19T02:17:27.318280Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2021-08-19T02:17:27.335112Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.19) starting as process 2828 ...
2021-08-19T02:17:27.421394Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2021-08-19T02:17:27.428986Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2021-08-19T02:17:27.429541Z 0 [ERROR] Aborting
2021-08-19T02:17:27.429688Z 0 [Note] Binlog end
2021-08-19T02:17:27.432786Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
And I found adding --user=root to Ares's answer will start mysql server successfully.
sudo /usr/local/mysql/support-files/mysql.server start --user=root
Ref.: MySQL Server Command User Options

Mysql not restarting in ubuntu

I am trying to connect my java program in the host OS with the mysql database in the ubuntu VM. I have created the necessary tables in the database and changed the bind-address in the my.cnf file to that of the host OS address. While I am trying to restart mysql, I am getting:
mysql stop/waiting
start: Job failed to start.
Then when I am trying to access mysql, I am getting the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)
Please help me with the solution.
Simply follow below step to start MySQL server.
Try to restart MySQL server from terminal. (In RHEL that is /etc/init.d/mysqld restart)
Still same issue then follow below step.
Rename mysql.sock file with another name e.g. mysl.sock_old in following directory.
/var/run/mysqld/
Now restart your MySQL server.
I have the same issue with mysql on Ubuntu14.04.
I fixed the issue by commenting configuration in /etc/mysql/my.cnf file.
innodb_buffer_pool_size=10G
innodb_log_file_size=54M
After commenting mysql service runs well..
Note :- If you comment these configuration then default configuration will take care the size of buffer pool and log file.
So not any issue .
But if you want to mention it manually , then provide 80% of your physical memory to buffer pool size.
and 25% of buffer pool size to log file.

MySQL won't start on XAMPP server

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.