Does mysql logs replication errors? I tried to google around but not much help.
If the errors are logged, where is it logged?
Assuming that you are running on a Linux environment, the short answer is that it is liking in the mysql.err file in your logs directory.
A more detailed answer can be found by executing this command
lsof -nc mysqld | grep -vE '(\.so(\..*)?$|\.frm|\.MY?|\.ibd|ib_logfile|ibdata|TCP)'
This will list all files that your database has open. From here you are looking for these two lines:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 30257 mysql 1w REG 253,4 10229 270851 /var/log/mysql/mysql.err
mysqld 30257 mysql 2w REG 253,4 10229 270851 /var/log/mysql/mysql.err
This is showing that, MySQL writes log messages and errors into /var/log/mysql/mysql.err. 1w and 2w are file descriptors 1 (stdout) and 2 (stderr) and both were redirected from console to the specified file.
More information about the files that appear in that command can be found in this article.
Related
I can see that variables inside /etc/mycnf file are different from the variables that i see through 'show variables' command, how is this possible? how can i fix this?
For example the output given by the following command: show variables like '%data%'; gives different variables output with respect to the ndf file.
Be sure to have it in the correct, corresponding section of the my.cnf configuration file once you are convinced you have it inside the correct my.cnf file, or the one with the highest priority.
My example case was I had it previously under various sections [mariadb], [mysqld], [mysql], [client-server] , whereas my setting log_slow_queries needed to be under the section name [server] which was not even there, I just figured it out by trial and error.
To be pretty sure the given file is the correct one to use, try to add a setting log_slow_queries under the [mysql] field and it will complain as it's the server setting and the [mysql] section is for the client configurations, but if it will complain with an error you know that .cnf file is used and when it's tested via a CLI client, the server error are usually suppressed and quite often not available even in the logs .
Or you can find out exactly which files are read by mysql/mariadb server by issuing this command
mysqladmin --help | grep -A1 'Default options'
or
strace mysql ";" 2>&1 | grep cnf
or
mysqld --help --verbose | grep my.cnf
command journalctl -xe for investigating a few recent related errors with mysql service
Up until today MYSQL was working OK for months with 2 MAMP Drupal localhost builds.
But now MYSQL no longer loads.
When opening MAMP the Apache Server starts,
whereas the MYSQL Server does not start.
This means the "Open WebStart page" option is greyed over and the Drupal path that would normally load the site just displays an error.
Using Terminal, if I run:
which mysql
the response is:
/Applications/MAMP/Library/bin/mysql
But if I try to login into MYSQL via Terminal:
mysql -u (myuser) -p
I am prompted for the password, but after entering correct password I receive:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/Applications/MAMP/tmp/mysql/mysql.sock' (2)
I checked that path, and there is no mysql.sock file there. In that directory there is just one file titled .dummy that has no content in it.
Some forums relating to the same error suggest I check and stop any other running MYSQL instances, but I don't appear to have any.
For example I ran:
ps -ef | grep mysql
And I just receive this:
501 11212 10699 0 12:31pm ttys000 0:00.00 grep mysql
I don't entirely understand that response, but it looks like there is nothing running that I can 'kill'.
Also, if I try things like:
sudo service mysql start
I am prompted for my Mac user password, which I enter, but I am then given the error:
sudo: service: command not found
Any help here would be greatly appreciated.
EDIT: I ran:
mysqld
And received a lot of information! Too long to paste here,
but some things I noticed were:
2019-02-14T03:01:33.211495Z 0 [Note] --secure-file-priv is set to NULL.
Operations related to importing and exporting data are disabled
I don't know how to address the above, but it sounds like it's not helping the situation?
Further on from there, the first 'warning' from the list was:
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
I followed that advice and ran:
mysql_upgrade
and received this error:
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
Any ideas as to how to fix that?
Some other errors I noticed are:
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
[ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
[ERROR] Aborting
followed by a lot of lines of "shutting down plugin...(various)..." that ended in:
mysqld: Shutdown complete
Again, I am completely lost here?
After hours of trying out suggestions from various forum threads, such as:
Creating my.cnf files; or
Adjusting the MAMP php.ini file with extra code, or
Reinstalling MAMP again,or
Dumping the "ib_logfile.." files from the MAMP/db/mysql57 directory,
The only thing that finally resolved this for me was:
I suddenly remembered I copied all my working files to a backup.
so I checked the backup directories for MAMP/db/mysql57 and noticed there was a lot of content in there that for some reason was now missing from my live version,
so I deleted everything in the current MAMP/db/mysql57 directory and pasted all the backup items in.
Suddenly MAMP's MYSQL server lights up, the Startup page auto loads into my browser and I can run drush commands in my CLI and load the Drupal CMS again.
Happy Days!
I am trying to use the LOAD DATA INFILE MySQL command on a Raspberry Pi running Raspbian. There are lot of similar questions on here but none seems to answer my problem exactly.
My code works fine on my Windows dev machine but on the Pi I get this error:
Can't get stat of '/var/www/transfer/categories.csv' (Errcode: 13)
Mysql statement is:
LOAD DATA INFILE '/var/www/transfer/categories.csv'
IGNORE INTO TABLE category
FIELDS TERMINATED BY ',' ENCLOSED BY '"';
The code is running in PHP and the database is MySQL.
The file and its '/transfer' folder have read permissions for World.
I have read a little about apparmor but can't see how to check or change how it is configured. There are 2 files in the /etc/apparmor.d folder. One is .usr.sbin.mysqld.swp but it doesn't seem to contain text and the other file refers to lightdm.
The database server and client is on the same server, so the LOCAL keyword doesn't apply.
My MySQL user has global privileges, so includes the FILE privilege.
I have checked the secure_file_priv setting and there is none.
I am sure this is some sort of permission or privilege issue, but I've run out of ideas. I want the file to live under the www folder because the system user has FTP rights to put it there. Ultimately I want to also create the file on the same machine but for now I'm happy to just read the file created under Windows.
$ errno 13
EACCES 13 Permission denied
Check your permissions; especially folder permissions. You can try su or sudo -u to the MySQL user and running ls -la /var/www/transfer/; if you don't see anything then you know the issue has to do with permissions of the folder and/or its contents.
If MySQL is running locally; to see which user: ps -elf | grep mysql
To switch to the MySQL user and test: sudo -u <mysql> bash
I installed MySQL community server 5.7.10 using binary zip. I extracted the zip in c:\mysql and created the data folder in c:\mysql\data. I created the config file as my.ini and placed it in c:\mysql (root folder of extracted zip). Below is the content of the my.ini file
# set basedir to your installation path
basedir=C:\mysql
# set datadir to the location of your data directory
datadir=C:\mysql\data
I'm trying to start MySQL using mysqld --console, but the process is aborted with the below error.
2015-12-29T18:04:01.141930Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2015-12-29T18:04:01.141930Z 0 [ERROR] Aborting
Any help on this will be appreciated.
You have to initialize the data directory by running the following command
mysqld --initialize [with random root password]
mysqld --initialize-insecure [with blank root password]
The mysql_install_db script also needs the datadir parameter:
mysql_install_db --user=root --datadir=$db_datapath
On Maria DB you use the install script mysql_install_db to install and initialize. In my case I use an environment variable for the data path. Not only does mysqld need to know where the data is (specified via commandline), but so does the install script.
mysqld --initialize to initialize the data directory then mysqld &
If you had already launched mysqld& without mysqld --initialize you might have to delete all files in your data directory
You can also modify /etc/my.cnf to add a custom path to your data directory like this :
[mysqld]
...
datadir=/path/to/directory
As suggested above, i had similar issue with mysql-5.7.18, i did this in this way
1. Executed this command from "MYSQL_HOME\bin\mysqld.exe --initialize-insecure"
2. then started "MYSQL_HOME\bin\mysqld.exe"
3. Connect workbench to this localhost:3306 with username 'root'
4. then executed this query "SET PASSWORD FOR 'root'#'localhost' = 'root';"
password was also updated successfully.
I had the same problem. For some reason --initialize did not work.
After about 5 hours of trial and error with different parameters, configs and commands I found out that the problem was caused by the file system.
I wanted to run a database on a large USB HDD drive. Drives larger than 2 TB are GPT partitioned! Here is a bug report with a solution:
https://bugs.mysql.com/bug.php?id=28913
In short words: Add the following line to your my.ini:
innodb_flush_method=normal
I had this problem with mysql 5.7 on Windows.
My problem was caused by an incorrect db restore.
When I dumed the db it also picked up the system mysql tables because I added a space after -p as mentioned here: mysqldump is dumping undesired system tables
Launching the docker instance would work, then I'd restore (and corrupt) the db and it would still keep running, but after restarting it would Exit with error code 1.
The solution was to dump and restore properly without the system tables.
I face the same issue with version Mysql 5.7.33 when the server has rebooted. I fix it by copy other server user files scp /var/lib/mysql/mysql/user.* root#dest:/var/lib/mysql/mysql.
I typed
/usr/local/zend/mysql/bin/mysql -u root
and I got
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/usr/local/zend/mysql/tmp/mysql.sock' (2)
I looked for the way to fix this error in books and internet search and I found several answers, all different and nothing works. Please don't post an answer if you are not positive that it will work
First run ,
mysqld --print-defaults
find in output --socket=[path_to_socket] (it is path to socket file, which mysqld will create when run).
Then you should check is mysql is runing, you can check it with
ps axu | grep mysqld
if it is runing, then you can run
mysql -S [path_to_socket]
If it is will not help, please attach output of
mysqld --print-defaults