In an article about securing MySQL they recommended disabling LOCAL INFILE unless I need it.
http://www.greensql.com/content/mysql-security-best-practices-hardening-mysql-tips
I would like to do the same in MariaDB but the following config line doesn't seem to work in MariaDB (used to work in Mysql):
set-variable=local-infile=0
Does anybody know how to disable it? Or maybe it doesn't have a runtime config switch and needs to be compiled with a specific configure flag?
The set-variable method of setting variables was deprecated in MySQL 5, and instead you can set the variable by name directly in my.cnf.
This works for me in MariaDB 5.5.34:
[mysqld]
local-infile=0
MariaDB's documentation on setting server variables recommends setting values in my.cnf using the format
variable-name = "value"
Related
I have been looking for how to create a database replication with MariaDB but the steps I find on the official page of how to do it https://mariadb.com/kb/en/setting-up-replication/ give me an error in this He passed:
Example that enables replication for MariaDB
Add the following to your my.cnf file and restart the database.
[mariadb]
log container
server_id = 1
log-basename = master1
binlog-format = mixed
When I change the file, I get a 1067 error when restarting the MariaDB service. All the examples I find, are solutions for Linux, also try changing the environment variables. Is there a solution to this error? Or is there another way to create a replication?
I already resolved it!. The error was because I followed the tutorial deleting what the default my.ini file contains and I replaced it with what the tutorial told me and what you have to do is add the new configuration below to the file and that's it.
Then the same is done with the slave, remembering to change the server number.
I use MySql 5.6 on Ubuntu 12.04.
I try to add a user defined global variable, that will be accessible across multiple sessions:
in ~/.my.cnf I have:
[mysqld]
lower_case_table_names=2
set-variable=my_global_variable=my_string_value
Then I restarted MySql.
When I do show variables, I do not see any variable called "my_global_variable".
What might I be missing here?
http://dev.mysql.com/doc/refman/4.1/en/option-files.html
Set the program variable var_name to the given value. This is
equivalent to --set-variable=var_name=value on the command line.
Spaces are permitted around the first “=” character but not around the
second. This syntax is deprecated as of MySQL 4.0. See Section
4.2.3.4, “Using Options to Set Program Variables”, for more information on setting program variables.
Read the MySQl 5.6 docs about the options file.
In WAMPs MySQL my.ini file you can specify the location of the mysql error log file, but if I try setting this variable in the my.ini of MariaDB it will not start. I assume it is not recognizing the variable, which worked fine in WAMP.
How do I set the MySQL error log file when using MariaDB?
MariaDB uses a separate option called log-basename
--log-basename=name (for example if name is mypc then mypc.err will be created as a error log)
Basename for all log files and the .pid file. This sets all log file names at once (in 'datadir') and is normally the only option you need for specifying log files.
This is especially recommend to be set if you are using replication as it ensures that your log file names are not depending on your host name. Sets names for --log-bin, --log-bin-index,--relay-log, --relay-log-index, --general-log-file, --log-slow-query-log-file, --log-error-file, and --pid-file.
I've installed MAMP and have the latest phpMyAdmin on my Mac. I do not have a my.cnf nor a my.ini file. Yes, I have enabled all invisible files.
I've heard the free version of MAMP doesn't let you, but that doesn't seem right. I know MAMPPro has a drop-down but I'm not buying that.
What else could the file be called?
EDIT: I used grep to search for innodb_buffer_pool_size within the entire MAMP folder and the only files that had that variable inside were assigning an array to it, not just a simple size. Just for more completeness on this question.
You can do the following:
MySQL 5.0+
SHOW VARIABLES LIKE 'innodb_buffer_pool_size';
MySQL 5.1+
SELECT variable_value FROM information_schema.global_variables
WHERE variable_name = 'innodb_buffer_pool_size';
In order to set it for MySQL, you must have a physically manifest my.cnf or my.ini
Add this to the config file
[mysqld]
innodb_buffer_pool_size = 1G
and restart mysql
You can try placing the my.cnf in /etc and restarting mysql
Please keep in mind that 128M is the default value for innodb_buffer_pool_size in MySQL 5.5. Once you get my.cnf in the correct place in the DB Server and restart mysql, things will be different.
If you have a configuration file for MySQL from MAMP then it would be located in /Applications/MAMP/db/mysql/my.cnf.
If there is no configuration file then the default value of 8MB.
I am trying to increase the size of the innodb_buffer_pool_size in MySQL 5.1 as I keep running into the following error indicating I have run out of space for the table locks.
ERROR: The total number of locks exceeds the lock table size
Error
Code: 1206
I have gone through the documentation and from what I gather, I need to update innodb_buffer_pool_size in the /etc/my.cnf file. My current value is 8M. However, even after creating that file and adding the following line to set the value it is not updating in MySQL.
set-variable=innodb_buffer_pool_size=256M
Does have any advice on how I can adjust this value in MySQL on my mac? Any other advice or suggestions?
add this to your my.cnf
innodb_buffer_pool_size=1G
restart your mysql to make it effect
In the earlier versions of MySQL ( < 5.7.5 ) the only way to set
'innodb_buffer_pool_size'
variable was by writing it to my.cnf (for linux) and my.ini (for windows) under [mysqld] section :
[mysqld]
innodb_buffer_pool_size = 2147483648
You need to restart your mysql server to have it's effect in action.
UPDATE :
As of MySQL 5.7.5, the innodb_buffer_pool_size configuration option
can be set dynamically using a SET statement, allowing you to resize
the buffer pool without restarting the server. For example:
mysql> SET GLOBAL innodb_buffer_pool_size=402653184;
Reference : https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool-resize.html
I had to put the statement under the [mysqld] block to make it work. Otherwise the change was not reflected. I have a REL distribution.
For standard OS X installations of MySQL you will find my.cnf located in the /etc/ folder.
Steps to update this variable:
Load Terminal.
Type cd /etc/.
sudo vi my.cnf.
This file should already exist (if not please use sudo find / -name 'my.cnf' 2>1 - this will hide the errors and only report the successfile file location).
Using vi(m) find the line innodb_buffer_pool_size, press i to start making changes.
When finished, press esc, shift+colon and type wq.
Profit (done).
As stated,
innodb_buffer_pool_size=50M
Following the convention on the other predefined variables, make sure there is no space either side of the equals sign.
Then run
sudo service mysqld stop
sudo service mysqld start
Note
Sometimes, e.g. on Ubuntu, the MySQL daemon is named mysql as opposed to mysqld
I find that running /etc/init.d/mysqld restart doesn't always work and you may get an error like
Stopping mysqld: [FAILED]
Starting mysqld: [ OK ]
To see if the variable has been set, run show variables and see if the value has been updated.