Disabling MySQL "secure-file-priv" option from Homebrew Installation - mysql

I had to reinstall MySQL 5.6 on OSX 10.12.4 with Homebrew 1.1.11 (mysql#5.6 formula) and this is the first time I've seen this issue. Basically, the new install appears to be enabling the --secure-file-priv option.
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
This is a well documented question and I've read the threads but none of them seem to speak to where Homebrew sets this option? All of the file locations mentioned don't appear for my installation of MySQL.
I just need to disable the option, I don't want to specify a specific folder. Any help is appreciated!

For anyone else that runs into this issue, you can solve the problem by placing a .my.cnf in your home directory containing:
[mysqld_safe]
[mysqld]
secure_file_priv=""

Related

MAMP MySQL won't start (Windows 10)

I see from reading around this is a very common problem and there are 2 recommended main solutions:
clear the temp files; and
check if another instance of MySQL is running.
Solution 1 - Clear files
I have cleared ib_logfile0, ib_logfil1 and iddata1. When I restart MAMP, it recreates these files but the server does not start.
Solution 2 - Close other instances of MySWL
I am unable to find a way to check if MySQL is already running else where. Reading around (inc MAMP help site), I should use Window task manager to search for "MySQLd" and close any instances that are running, however Win10 seems to have delete the search function from the task manager. A look through the processes did not show any though:
screen shot of windows task manager
Next I have seen people adding "innodb_force_recovery = 1" to my.cnf file. I searched for my.cnf but couldn't find it. Instead I tried adding the line to C:\MAMP\conf\mysql\my.ini and I also tried adding "innodb_force_recovery = 2". Neither worked.
I tried changing the port number that MySQL uses to 3307, that didnt work either.
Finally, I uninstalled and re-installed MAMP - didn't work.
The MySQL error log reads:
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
[Note] C:\MAMP\bin\mysql\bin\mysqld.exe (mysqld 5.7.24-log) starting as process 9044 ...
I think it would be useful if there is a way to check for instances of MySQL running via the command line, and then if they is one, how to close it from the command line.
Following steps fixed my issue
1. Stop your MAMP Server.
2. Find the db folder for mysql. In my case: C:\MAMP\db\mysql
3. Rename the mysql-bin.index file to mysql-bin_old.index
4. Start your MAMP Server
This question has been answered here:
MySQL Server on MAMP-Windows Will Not Start
The fix posted by this user apparently comes from MAMP support. My problem was identical to yours and it worked for me. The issue related to binary logging, which can be disabled in a configuration file.
Good luck.
This is what worked for me :
Click on Start Servers in MAMP
Manually click on mysql.exe in MAMP installation folder
C:\MAMP\bin\mysql\bin\mysql.exe

Confused with homebrew version mysql and official mysql preferences pane on mac

I downloaded mysql for my Mac from official website 'mysql.com', then launched it on my server using preferences pane and as well as from command line using
sudo /usr/local/etc/mysql/support-files/mysql.server start
Its working good, but during my development process i want to change the sql_mode,because i am getting below error
sql_mode=only_full_group_by
Many of them said to change sql mode config in /usr/mysql/my.cnf, but unfortunately i don't see that directory on my mac, So i installed Homebrew version mysql ,this also not working.
My Problem is where I can find my.cnf file on my mac? now i am not using homebrew version of mysql, I'm using official mysql downloaded from mysql.com/downloads.
Run mysql --help it will show you the config file that is being loaded.
Finally i got solution, i created new file inside /etc called my.cnf and set this as
[mysqld]
# Default : STRICT_TRANS_TABLES,ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql_mode = ""
Now its working great :) Thanks for your responses!

OSX MySql terminal parameters

So I am going crazy with this. I have MAMP installed and it's MySQL is working fine. I now installed MySQL 5.7.19 from the official dmg from their site and installed.
From the pref panel I am not getting status updates and as such I cannot stop it even though it is running. Trivial though as I can launctl unload it.
However, the big issue I am facing is that although the server starts correctly (from pref panel) and I can see the process running and the respective /tmp/mysql.sock file when I try to run mysql in terminal (or any other mysql command) I get an error stating it cant find the sock file and it pipes out the Applications/MAMP path.
I looked everywhere for a my.cnf that might be setting this and there are none (apart from the one used by MAMP). No environment variables set to override it, nothing. In fact, there are no other my.cnf files but for some reason it still thinks it should be using /Applications/MAMP path.
my_print_defaults client confirms this as it pipes out
--socket=/Applications/MAMP/tmp/mysql/mysql.sock
but I have absolutely no idea where and how this is being set and I need to be able to run on this instance terminal commands. Driving me crazy for hours now.
No files at
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
No environment variable MYSQL_UNIX_PORT as described here: https://dev.mysql.com/doc/refman/5.7/en/problems-with-mysql-sock.html
So how the heck is it getting this value?
Also checked at DATA_DIR and BASE_DIR, no my.cnf there either.
Obviously Ive done which mysql to confirm I am calling the correct binary.
Any help much appreciated!
UPDATE Running my_print_defaults client --verbose --no-defaults pipes the same exact output, so I am guessing it is somehow set elsewhere. Where can this variable be set otherwise?
Ok so I found the answer after all and sharing it for anyone having the same issue.
In essence, the --socket parameter is added via the ~/.mylogin.cnf file!
I am not sure if I ever added it there but I am pretty sure it wasn't me, so I am guessing MAMP did it.
This is an encrypted file so you can't edit it directly by you can change it via mysql_config_editor:
mysql_config_editor remove --socket
And problem solved!

MAMP Pro Error: The MySQL configuration file my.cnf couldn't be written

I tried to use MAMP Pro to replace previous XAMPP on my Mac due to its easy Virtual Hosts management. However after I installed it. The MAMP, basic version works, but the Pro version keeps given me this error message:
The MySQL configuration file my.cnf couldn't be written.
I googled for a while and there are some different solutions, like create my.cnf on /etc/, but none of these works. Also the error log is empty.
Has someone encountered this before? Or does anyone have a clue how could I solve this problem? Thank you!
I just purchased MAMP PRO and I'm having this error as well. Here's what "fixed" it:
Open Terminal and type in sudo killall -9 mysqld. You might see "No matching processes belonging to you were found," which is fine, it means that MySQL was not running.
Now, in Applications, look for the regular MAMP folder. Open MAMP here and click Start Servers
Now open MAMP PRO and the servers should be started
This is just a work-around, it definitely should not require these. At the very least, this should get you up and running.
Contacting support!
File -> Reset to Factory Settings
Possibly a permissions issue, but I wasn't able to resolve it. The above fixed it for me.
uninstall mamp.
remove all files about mamp.
reinstall mamp.
I removed 'my.cnf' from '/etc' directory. Restarted MAMP pro. Started server successfully.....
Your configuration may be wrong.
exp.
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION # success
or
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' # error

How to enable inno-db support on MySql 5 installed above MySql 4?

How to enable inno-db support on installed instance of MySql?
I have installed mysql-5.0.67-win32.
'InnoDB' is 'DISABLED' when executing 'show engines'.
According to documentation MySql is compiled with support of inno-db
(From doc: A value of DISABLED occurs either because the server was started with an option that disables the engine, or because not all options required to enable it were given.)
In my.ini I commented line with 'skip-innodb'. This didn't help.
All other inno-db related variables remain unchanged.
I have performed some unusual action before I experienced described situation.
I have mysql-4.0.17-win installed. I uninstall it and after this installed mysql-5.0.67-win32.
In installation wizard I chose MyISAM support only (as far as I understand I disabled inno-db support in such way. When I tried to reinstall with support of inno-db I had problems of using my previous database 'mysql' with account information).
MySQL documentation says that I should use mysqldump to export data and after this to import exported data in process of upgrade. I tried to do so, but when importing data I obtained message about syntax error (I think that it is connected with some incompatibilities of 4-th and 5-th version of mysql)
Should be enabled by default. There are some situations where wrong permissions on the MySQL lib folder cause InnoDB to bark. Check your MySQL error log for permission errors.
I do have the following innodb options in my.ini. It is a very minimal configuration, so dont' use this values if you would like mysql to have a good performance. Please restart mysql after a change of my.ini.
#*** INNODB Specific options ***
innodb_data_home_dir="C:/mysqldata/"
#skip-innodb
innodb_additional_mem_pool_size=120M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=16M
innodb_buffer_pool_size=10M
innodb_log_file_size=2M
innodb_thread_concurrency=8
Maybe you have inno-db disabled in the global configuration file. On Linux this would be something like /etc/mysql/my.cnf - maybe Windows has a similar global conf-file.
Make sure you are changing the correct my.ini file. On Windows this is read from many locations. The order is:
WINDIR\my.ini, WINDIR\my.cnf
C:\my.ini, C:\my.cnf
INSTALLDIR\my.ini, INSTALLDIR\my.cnf
defaults-extra-file
Type mysql --help in the command prompt to see the actual order on your computer e.g.:
Default options are read from the
following files in the given order:
C:\my.ini C:\my.cnf C:\WINDOWS\my.ini
C:\WINDOWS\my.cnf C:\Program
Files\MySQL\M ySQL Server 5.0\my.ini
C:\Program Files\MySQL\MySQL Server
5.0\my.cnf
have you checked the startup parameters? maybe the shell script or batch file that you use to start up the server disable the engine on the command line.. IIRC command line flags trumps the .ini settings.
I have resolved the problem.
In short:
I was not able to dump databases on MySql4 and restore it on MySql5 due to some strange syntactic errors when importing data.
I tried after installation to override MySql5 databases with old ones, including database 'mysql'. It works ok but I was not able to enable inno-db support. (In such way I even was able to use function PASSWORD for old passwords (instead of OLD_PASSWORD))
Since database structure of 'mysql' is changed in 5 version I tried to install MySql5 again and copied my old databases except 'mysql' one. After this I updated 'mysql' database with corrected version of exported data from 'mysql'. In such a way I obtained mysql 5 working.
After all I also executed mysqlcheck --all-databases --auto-repair
to upgrade my tables.
P.S. Thank to authors of all answers which hint me to the correct way of resolving problem.