Help requested on 'mysqldump' error
I'm in the hell figuring out why following error happens. So, please, anybody help me. My writing: A, B, C, D
s
A. Here is my.ini file
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = C:\mysql-5.6.27
datadir = C:\mysql-5.6.27\data
port = 3306
max_allowed_packet=16M
character-set-client-handshake = false
init_connect="SET collation_connection=utf8_general_ci"
init_connect="SET NAMES utf8"
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake
default-character-set=utf8
#bind-address = 0.0.0.0
#explicit_defaults_for_timestamp=1
[mysql]
default-character-set = utf8
[mysqldump]
#sql_mode=NO_AUTO_VALUE_ON_ZERO
========================== end of ini file
B. I executed the following command ==>
C:\mysql-5.6.27\bin> mysqldump -uroot -p --databases parkinglot > prugio.sql
C. Here is the response on my mysqldump
mysqldump: unknown variable 'sql+mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES'
D. For your reference, I upgraded mysql version from 5.6.24 to 5.6.27.
Thank you very much in advance.
I just found answer myself. I had my.ini in two plases. one in C drive and the other one in D drive. That caused the confusion. As soon as I renamed one of the my.ini, the problem didn't happen.
Related
When launching mysqlbinlog it returns an error:
root#utils # mysqlbinlog --start-datetime="2021-12-05 13:13:00"
mysqlbinlog: unknown variable 'default-character-set=utf8mb4'
How to fix it?
Maybe, it related to the contents of /etc/mysql/mariadb.conf.d/50-client.cnf which is:
[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
default-character-set = utf8mb4
# socket location
socket = /var/run/mysqld/mysqld.sock
# Example of client certificate usage
# ssl-cert=/etc/mysql/client-cert.pem
# ssl-key=/etc/mysql/client-key.pem
#
# Allow only TLS encrypted connections
# ssl-verify-server-cert=on
# This group is *never* read by mysql client library, though this
# /etc/mysql/mariadb.cnf.d/client.cnf file is not read by Oracle MySQL
# client anyway.
# If you use the same .cnf file for MySQL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]
The server configuration is:
Server version: 10.3.31-MariaDB-0ubuntu0.20.04.1-log Ubuntu 20.04
character-set-server = utf8mb4
or
mysqlbinlog --no-defaults mysql-bin.000001
Another solution is to add the loose_ prefix to the failing option:
[client]
loose-default-character-set=utf8mb4
The loose prefix forces command line tools not to throw an error, if the option isn't supported.
Move the default-character-set=utf8 line below the [mysql] or [mysqld]
sections of your my.cnf file. mysqlbinlog reads variables under
[client], but not [mysql]. Your command-line client and/or browser
reads the [client] AND [mysql] sections of the config file.
BTW, mysqlbinlog can take a specified character set, if you use the
--set-charset=charset_name (>5.0.23) option.
source: https://forums.mysql.com/read.php?103,189835,192421#msg-192421
I'm using MySQL / 10.1.29-MariaDB-6 on Kali Linux 2018 VM.
I have the following entry in mariadb.cnf, mysql.cnf, and 50-server.cnf.
general_log_file = /var/log/mysql/mysql.log
general_log = 1
The conf file shows that the following config files are used to determine options:
The MariaDB/MySQL tools read configuration files in the following order:
/etc/mysql/mariadb.cnf (this file) to set global defaults,
/etc/mysql/conf.d/*.cnf to set global options.
/etc/mysql/mariadb.conf.d/*.cnf to set MariaDB-only options.
~/.my.cnf to set user-specific options.
Logging IS working to the file specified, but whenever I try to type the following mysql command, I am met with the following error:
root#kali:/var/log/mysql# mysql -u root -p
mysql: unknown variable 'general_log_file=/var/log/mysql/mysql.log'
How to fix this error?
Check the sections of the config file(s) where general_log_file option is set. It must be [mysqld], or [server], or [mariadb] and alike, but it must not be [mysql] or [client] or alike. general_log_file is a server-only option.
i've looked up every tutorial on how to fix this and nothing worked so far,
I'm getting this error
No connection could be made because the target machine actively refused it
i'm using linux centos7 mysql version
mysql Ver 14.14 Distrib 5.6.32, for Linux (x86_64) using EditLine wrapper
blow is my.cnf
also i had to create my own my.cnf as when i installed mysql it didn't have one located i put this into etc/my.cnf it's running the cnf as it's taken mysql out of strict mode.
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
bind-address = 0.0.0.0
#skip-networking
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Ok, I am assuming that you have installed this on a completely different machine (as opposed to a Virtual Host on your Windows box).
You need to make sure that port 3306 is open on your DB server first and foremost. You can check this with a port checker (there are plenty of free ones online).
Then, with the user you are trying to connect with, you need to make sure that user has access from the origin IP address (i.e. the IP on your Windows machine). This can be done with the following code from the mysql prompt.
GRANT ALL PRIVILEGES ON <your db name>.* TO <your user>#<your ip> IDENTIFIED BY '<your password>';
A less secure option would be to allow all inbound IPs by using the % wildcard.
After this you need to run the following command.
FLUSH PRIVILEGES;
That should be it.
I have downloaded MYSQL via:
bash <(curl -Ls http://git.io/eUx7rg)
Prior to installing I've completely uninstalled previous components via:
http://community.jaspersoft.com/wiki/uninstall-mysql-mac-os-x
I've had to modify permissions in order to see the log file and see primarily permissions errors. Also, when I try:
type mysql
The result, in terminal, points to a directory that does not exist on my local system. When I trace the path to the executable (via Finder) I get the following error in Terminal:
/usr/local/mysql-5.6.19-osx10.7-x86_64/bin/mysql ; exit;
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
logout
Also, when I look at my.conf file, everything is asterisked out:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
Had the same problem. Had to switch machines for a week and installing MySQL on "OS X 10.9.3 (13D65)" would not work. Had to wipe the account clean and reinitialize the user to get it going. Apparently there was still an old mysql which wasn't uninstalled completely. Google "uninstall mysql manually"
The access denied happens sometime when the grant is given to the interface 127.0.0.1 but not to localhost.
Try granting access to %, 127.0.0.1, and localhost.
I've read that Mysql server creates a log file where it keeps a record of all activities - like when and what queries execute.
Can anybody tell me where it exists in my system? How can I read it?
Basically, I need to back up the database with different input [backup between two dates] so I think I need to use log file here, that's why I want to do it...
I think this log must be secured somehow because sensitive information such as usernames and password may be logged [if any query require this]; so may it be secured, not easily able to be seen?
I have root access to the system, how can I see the log?
When I try to open /var/log/mysql.log it is empty.
This is my config file:
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
log = /var/log/mysql/mysql.log
binlog-do-db=zero
user = mysql
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
skip-external-locking
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
general_log_file = /var/log/mysql/mysql.log
general_log = 1
Here is a simple way to enable them. In mysql we need to see often 3 logs which are mostly needed during any project development.
The Error Log. It contains information about errors that occur while
the server is running (also server start and stop)
The General Query Log. This is a general record of what mysqld is
doing (connect, disconnect, queries)
The Slow Query Log. Ιt consists of "slow" SQL statements (as
indicated by its name).
By default no log files are enabled in MYSQL. All errors will be shown in the syslog (/var/log/syslog).
To Enable them just follow below steps:
step1: Go to this file (/etc/mysql/conf.d/mysqld_safe_syslog.cnf) and remove or comment those line.
step2: Go to mysql conf file (/etc/mysql/my.cnf) and add following lines
To enable error log add following
[mysqld_safe]
log_error=/var/log/mysql/mysql_error.log
[mysqld]
log_error=/var/log/mysql/mysql_error.log
To enable general query log add following
general_log_file = /var/log/mysql/mysql.log
general_log = 1
To enable Slow Query Log add following
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes
step3: save the file and restart mysql using following commands
service mysql restart
To enable logs at runtime, login to mysql client (mysql -u root -p) and give:
SET GLOBAL general_log = 'ON';
SET GLOBAL slow_query_log = 'ON';
Finally one thing I would like to mention here is I read this from a blog. Thanks. It works for me.
Click here to visit the blog
The MySQL logs are determined by the global variables such as:
log_error for the error message log;
general_log_file for the general query log file (if enabled by general_log);
slow_query_log_file for the slow query log file (if enabled by slow_query_log);
To see the settings and their location, run this shell command:
mysql -se "SHOW VARIABLES" | grep -e log_error -e general_log -e slow_query_log
To print the value of error log, run this command in the terminal:
mysql -e "SELECT ##GLOBAL.log_error"
To read content of the error log file in real time, run:
sudo tail -f $(mysql -Nse "SELECT ##GLOBAL.log_error")
Note: Hit Control-C when finish
When general log is enabled, try:
sudo tail -f $(mysql -Nse "SELECT CONCAT(##datadir, ##general_log_file)")
To use mysql with the password access, add -p or -pMYPASS parameter. To to keep it remembered, you can configure it in your ~/.my.cnf, e.g.
[client]
user=root
password=root
So it'll be remembered for the next time.
You have to activate the query logging in mysql.
edit /etc/my.cnf
[mysqld]
log=/tmp/mysql.log
restart the computer or the mysqld service
service mysqld restart
open phpmyadmin/any application that uses mysql/mysql console and run a query
cat /tmp/mysql.log ( you should see the query )
From the MySQL reference manual:
By default, all log files are created in the data directory.
Check /var/lib/mysql folder.
In my (I have LAMP installed) /etc/mysql/my.cnf file I found following, commented lines in [mysqld] section:
general_log_file = /var/log/mysql/mysql.log
general_log = 1
I had to open this file as superuser, with terminal:
sudo geany /etc/mysql/my.cnf
(I prefer to use Geany instead of gedit or VI, it doesn't matter)
I just uncommented them & save the file then restart MySQL with
sudo service MySQL restart
Run several queries, open the above file (/var/log/mysql/mysql.log) and the log was there :)
Enter MySQL/MariaDB server command-line tool as root
Set file path (you can replace general.log with the file name of your choice).
SET GLOBAL general_log_file='/var/log/mysql/general.log';
Set log file format
SET GLOBAL log_output = 'FILE';
Enable the server general log
SET GLOBAL general_log = 'ON';
Check your configurations in global configuration variables.
SHOW VARIABLES LIKE "general_log%";
Enter exit to leave MySQL command-line and Tail your queries by
tail -f /var/log/mysql/general.log
or
less /var/log/mysql/general.log
To disable the general server log
SET GLOBAL general_log = 'OFF';
To complement loyola's answer it is worth mentioning that as of MySQL 5.1 log_slow_queries is deprecated and is replaced with slow-query-log
Using log_slow_queries will cause your service mysql restart or service mysql start to fail
In addition to the answers above you can pass in command line parameters to the mysqld process for logging options instead of manually editing your conf file. For example, to enable general logging and specifiy a file:
mysqld --general-log --general-log-file=/var/log/mysql.general.log
Confirming other answers above, mysqld --help --verbose gives you the values from the conf file (so running with command line options general-log is FALSE); whereas mysql -se "SHOW VARIABLES" | grep -e log_error -e general_log gives:
general_log ON
general_log_file /var/log/mysql.general.log
Use slightly more compact syntax for the error log:
mysqld --general-log --general-log-file=/var/log/mysql.general.log --log-error=/var/log/mysql.error.log
shell> mysqladmin flush-logs
shell> mv host_name.err-old backup-directory