I'm using the Mysql Server version: 10.1.21-MariaDB on Windows 7, and when I run the flollowing command SHOW VARIABLES LIKE 'have_symlink'; I get :
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_symlink | NO |
+---------------+-------+
So I want to enable them.
What have I tried ?
running : mysql --symbolic-links yields the following error :
mysql: unknown option '--symbolic-links'
I've searched for location where a config file might be present so I looked for my.cnf and my.ini in the following locations :
%WINDIR%\my.ini %WINDIR%\my.cnf \my.ini \my.cnf %APPDIR%\mysql\my.ini %APPDIR%\mysql\my.cnf %APPDIR%\mysql\data\my.ini %APPDIR%\mysql\data\my.cnf to not find any file then I've created the following option file to be used when starting the server my.cnf with the following command :
[mysqld]
symbolic-links
I've made sure that in Windows:
Local to local symbolic links are enabled.
Local to remote symbolic
links are enabled.
So what am I doing wrong and how to make the have_symlink variable have a value of yes ??
EDIT:
I've restarted the server after the change to the my.cnf file, but without success
EDIT 2:
for the first mentioned error, it is because --symbolic-link is a server rather than client option, so I would type mysqld --symbolic-links and that relieves me of searching any option file, because the command line specified options take precedence.
You've got to do two things:
Put symbolic-links=1 in the configuration file (.cnf) under [mysqld].
Restart the MySQL Server.
After restarting, the have_symlink value should be yes.
Beware: Disabling symbolic-links is recommended to prevent assorted security risks (reference).
You appear to be running MySQL 10
symbolic-links is deprecated as of MySQL 8
https://dev.mysql.com/worklog/task/?id=8392
Symbolic links is defacto disabled on most MySQL distributions, because sample
configuration files contain:
symbolic-links=0
Since symbolic links allow MySQL to write data to any effective location on the
operating system, it creates two issues:
1) MySQL may be tricked into writing to locations it is not supposed to
2) MySQL may write to a location that has privileges that are too loose, and may
be tampered with by other users on the operating system.
(MySQL mitigates risk #1 by not overwriting existing files, but the risk still
remains as an attack vector.)
We therefore decided:
1) Change the compiled default to OFF (aligning with the defacto default)
2) Deprecate and remove this functionality in a future release.
Deprecation of --symbolic-links includes deprecating have_symlink.
Related
I wanted to disable some options in the MySql server strict mode, but for some reason I'm not even able to find its configuration file (my.cnf)
Currently installed MySql:
Ver 14.14 Distrib 5.7.20, for macos10.12 (x86_64)
Output generated by
mysql --help
Default options are read from the following files in the given order:
/etc/my.cnf
/etc/mysql/my.cnf
/usr/local/mysql/etc/my.cnf
~/.my.cnf
But there is no such file as my.conf
I had done some research work on SO but none of the advises has worked for me.
What I'm supposed to do?
There are defaults built into MySQL. The configuration file(s), if any, override the defaults.
Note that the config files are not looked at except during startup. So, editing or creating such a file has no effect until you restart mysqld.
If you mess up the syntax, mysqld will not start. Then you need to find the error, either during startup, or in a log file. (Or you could ask here "what is my syntax error".)
As for the location, and name, of the config files that will be used:
$ mysql --help
gives you the list for mysql, but perhaps you need it for the server, so try
$ mysqld --help --verbose
gives you long output; maybe 50 lines from the top, you should see something like:
Usage: mysqld [OPTIONS]
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
You asked about my.conf; was that a typo?
Regardless, If those files are missing, you can create them, make them readable by mysql, and put things into it preceded by [mysqld] so that the server will see them.
Personal override
Regardless of what is in the defaults and/or config files, you can add to the last file given. In the examples above that is 'hidden' .my.cnf in your home directory. All you need to do is create a few lines:
[mysql]
some_setting = somevalue
[client]
some_setting = somevalue
That helps for the "mysql" commandline tool and/or other clients (maybe).
But if you need to make changes to the server mysqld, it needs to be in one of the other files. Again, the minimum is something like
[mysqld]
some_setting = somevalue
Note the mysqld to refer to the server. And remember to restart the service.
Another note: If you see (in an existing config file), !includedir ..., then go to that directory to find any number of further files. You could add your own file, say z.cnf (so it would be picked last) with the two (or more) lines as indicated above.
If you have installed Mysql 8 or Above using the package installer from mysql website, then follow what i did
Create the config file in your home directory vim ~/.my.cnf
Do open System preferences in mac
Then Select the configuration file you created on the option.
The content in this website says.
I had the urgent need to configure some specific stuff in MySQL 5.7 on my developer machine, a MacBook Pro running Mac OS Sierra. Unfortunately, I did not find a my.cnf file that could be customized anywhere?
Internet research showed that MySQL Database Server on Mac OS runs without a my.cnf config file by default, simply started with default values.
Luckily, it is pretty simple to customize the MySQL Server installation by creating and editing a custom my.cnf file like this:
sudo cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
Then edit / customize the /etc/my.cnf file as required and restart your MySQL Server.
Or you can refer to this answer
You could try:
$ locate mysql | grep my.cnf
It should reveal the location(s) if it exists.
Location of MySQL configuration file (ie: my.cnf) not specified
How can I fixed this thing?
I been trying to reinstall mysqlserver 5.5 / 5.7 and workbench countless of time. But I still not able to fix this issue.
I solved this problem. Step one: click here
Step two: and then click here to choose your path
Step three: my path is C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
If you already know where your configuration file is located, but just don't know how to specify it in mySQLWorkbench, you can skip steps 1-3 and just follow step 4 in these instructions.
Step 1: Make sure which mysql is running (just in case you have multiple installations on your system) and how:
$ ps aux | grep mysql
may result in something like:
_mysql 120 0,0 3,4 5122736 565108 ?? Ss Fr01pm 61:05.93 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid
If, in this output, you see that mysqld has been started with the --defaults-file option, that option specifies the configuration file used by msql. If so, you have found the configuration file and can skip to step 4.
If not, check if this returns the same binary location as above command:
$ which mysqld
If not, then make sure you use the full path for mysqld from the first output in the following step.
Step 2: Ask mySQL which configuration files it is using:
$ mysqld --verbose --help | grep -A 1 "Default options"
should output something like:
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
Step 3: Check the given locations in that order. The first finding should be your mySQL configuration file.
Step 4: In mySQLWorkbench go to Database > Manage Connections, then select the connection, select tab System Profile, and enter the path and file name in Configuration File.
This should be it.
And if still nothing happens, you may have used the installer Package. If you have, then you must select the Installation Type from the drop-down to reflect that before you locate the configuration file.
Here's a screenshot that follows from the above screenshots
Also, there may not be a config file and you can create one here, then get out of the Options File, go back in and you will see all the options.
I changed my setting from Custom to MacOSx (MySQL Package) under: Database → Manage Connections → MySQL Connections → Select DB Connection → System Profile → Installation Type → (default setting) MySQL Package.
Change from custom to default setting:
Reconnect by testing connection:
For maria-db users
back up the original /etc/mysql/my.cnf
copy and rename /etc/mysql/mariadb.conf.d/50-server.cnf to /etc/mysql/my.cnf.
This would fix the problem.
Remember to revert changes after finish.
For those with Mac OS Catalina:
I did not have a my.cnf file. I went to /usr/local/mysql/
and created a directory named etc, which I did not have either.
Then, inside that directory, I created the file (my.cnf).
This is the link that helped me How to fix --secure-file-priv option error
for mysql 5.7 users and MAMP: just create /etc/my.cnf
macOS 13 and MySQL 8 current:
Open MySQL Workbench on your Mac. Connect into your localhost instance of MySQL.
Click the little wrench icon next to INSTANCE on the left pane above Startup / Shutdown.
Select macOS as System Type, macOS as Installation Type, and the rest will default into place. Copy the location it gives you for the my.cnf file.
Click Close
Now click Options File on the left. It will notice that you don't have a file and will show you default values.
Click the Apply... in the bottom right corner.
It will then ask you for a password of your current logged in user of your Mac to create and save the my.cnf file.
Now in the Finder use the keyboard combo of Command-Shift-G and copy in your location we copied early (i.e. /etc/my.cnf)
The default log error verbosity is 3 for mysql 5.7. I'm trying to set this to a level of 2 in the cnf file but I'm not sure of the syntax.
The GLOBAL variable log_warnings sets the level for verbosity which
varies by server version. The following snippet illustrates:
SELECT ##log_warnings; -- make a note of your prior setting
SET GLOBAL log_warnings=2; -- setting above 1 increases output (see server version)
log_warnings as seen above is a dynamic variable.
Configuration file changes in cnf and ini files might look like the
following.
[mysqld]
log_error = /path/to/CurrentError.log
log_warnings = 2
Please see the MySQL Manual Page entitled [The Error Log][] especially
for Flushing and Renaming the Error Log file, and [Error Log
Verbosity] with versions related to log_warnings. The GLOBAL variable
log_warnings sets the level for verbosity which varies by server
version. The following snippet illustrates:
SELECT ##log_warnings; -- make a note of your prior setting
SET GLOBAL log_warnings=2; -- setting above 1 increases output (see server version)
log_warnings as seen above is a dynamic variable.
Configuration file changes in cnf and ini files might look like
the following.
[mysqld]
log_error = /path/to/CurrentError.log
log_warnings = 2
Please see the MySQL Manual Page entitled The Error Log
especially for Flushing and Renaming the Error Log file, and Error Log
Verbosity with versions related to log_warnings.
MySQL 5.7.2 expanded the warning level verbosity to 3 and added the GLOBAL log_error_verbosity. Again, it was introduced in 5.7.2. It can be set dynamically and checked as a variable or set via cnf or ini configuration file settings.
As of MySQL 5.7.2:
[mysqld]
log_error = /path/to/CurrentError.log
log_warnings = 2
log_error_verbosity = 3
Change yours to 2 if you want, above.
You can dynamically set, and check, respectively, with:
SET GLOBAL log_error_verbosity=2; -- set it
SELECT ##log_error_verbosity=2; -- sanity check, view it
yet this will be reset to cnf or ini file settings upon server restart.
I will try to improve our Docs page on that.
How to set the Configuration file (cnf or ini, Linux or Windows, respectively).
The my.cnf and my.ini files reside in the basedir. If they do not exist, you can create them, else they will use defaults baked into the server. Often there is a stubbed out file in basedir, not active, named my-default, as a template. Use that to create the real my.cnf or my.ini. Issue a
SELECT ##basedir;
to find the location where my.ini (Windows) or my.cnf (Linux) should reside. Note, you will need to have sufficient rights to modify these files. In Windows, for instance, I need to run Notepad as Administrator to write such a file.
The following are a few commands issued to confirm a change to my.ini (for Windows, my.cnf for Linux) having set log_error_verbosity to 2. Note this is after a server restart which would have used those ini or cnf changes:
I show the use of basedir because that is where your ini or cnf file must exist depending on your operating system.
I've been trying to set up two databases as master & slave.
I followed the famous guide here:
https://dev.mysql.com/doc/refman/5.1/en/replication-howto-existingdata.html
But no luck on my slave server,
The issue I'm having is setting the server-id variable.
No matter where I define it (I looked into all the possible cnf files that might allow me to define the variable)
I tried to define it like so:
[mysqld]
server-id = 2
I also tried setting it by using SET GLOBAL server_id but obviously, it didn't save the setting.
when I do:
SHOW VARIABLES LIKE 'server_id'
It returns
server_id 0
Among the cnf files I've looked into are:
etc/mysql/mysql.conf.d/mysqld.cnf
etc/mysql/mysql.conf.d/mysqld_safe_syslog.cnf
etc/mysql/conf.d/mysql.cnf
etc/mysql/debian.cnf
etc/mysql/mysql.cnf
usr/my.cnf
usr/my-new.cnf
usr/etc/my.cnf
My MySQL server is running on Ubuntu.
And if it matters, I start it by typing:
service mysql start
I'd love to know where else I could look to fix this issue.
Thanks a bunch!
Additional Notes:
MySQL Ignoring the global conf file
I received this warning a couple of times and it disappeared when I returned the chmod to 644 on the etc/mysql folder, although every thing stated above was attempted using both 644 and 777 permissions, with 644 the warning disappears.
I know it's to late, but for those who will make the mistake.
It's server_id and not server-id:
[mysqld]
server_id = 2
For me it worked by renaming the from /etc/mysql/conf.d/my.cnf to /etc/mysql/conf.d/my.ini
I'm not sure of the exact reason for that (feel free to edit this answer and add to it).
I tried out various combinations:
Keeping the variable as: server-id and server_id
Keeping the group/section as: [mysql] and [mysqld]
Renaming the file to: my.cnf , mysqld.cnf, mysql.cnf, my.ini
You can keep trying various combinations out of the above options, it should definitely work. :)
What if there are more than one my.cnf files on my server?
Which configuration file will be looked by MySQL?
Assuming one runs mysql under linux, there the option-files will be read in that order:
the file specified by option --defaults-file=/PATH/TO/my.cnf while startup of mysqld
/etc/my.cnf
/etc/mysql/my.cnf
SYSCONFDIR/my.cnf (usually sysconfdir is /etc)
$MYSQL_HOME/my.cnf
the path set by --defaults-extra-file=/PATH/TO/my.cnf
~/my.cnf (your homedir, usually used for mysql-client configuration)
Also keep in mind that there are three options which change this behavior in MySQL:
-defaults-file=/PATH/TO/my.cnf - only read that option-file
-defaults-extra-file=/PATH/TO/myextra.cnf - read all global option-files, then this
-no-defaults - ignore every option-file and start with default
Please also refer to the docs on option-files: MySQL-Docs
The one specified on the command line that starts the mysqld process, or if no configuration file is specified, the default location. On Linux it is in /etc. I don't know where the Windows default is, but you can look in the documentation.