Can't open CloudSQL binlog: "No such file or directory" - mysql

I am trying to view the MySQL binlog files to trace down the source of a particular query. I used the SHOW BINARY LOGS query to get the names of the existing log files, but when trying to access using the mysqlbinlog command, I keep getting an error: "File 'xxxx' not found (Errocode: 2 "No such file or directory")".
I also tried accessing the file using the full path /mysql/binlog/mysql-bin/file-name and with double forward slashes and back slashes, but just got the same error. I tried a couple of different files, all gave the same error.
If anyone can explain what I am doing wrong, that would be appreciated.

Mysqlbinlog utility checks your local file system, in this case. For remote server connection, you should use the --read-from-remote-server option in your command line. You can read related detail on the "4.6.8 mysqlbinlog — Utility for Processing Binary Log Files" page.

Related

Import data from txt file to mysql workbench - windows

I have a kind of huge amount of data on a .txt file (something like 90.000 lines and 10 columns, each 'item' separed by comma) and I need to find a way to import it from my txt file to a mysql table.
I did some research and found the following code:
LOAD DATA INFILE "/my_path/file.txt" INTO TABLE "table" CHARACTER SET "utf8" FIELDS TERMINATED BY "," LINES TERMINATED BY "\r\n";
but that gives me the following error:
Error Code: 29. File '/my_path/file.txt' not found (OS errno 13 - Permission denied) 0.000 sec
So after searching a little bit more, I found that a lot of people had this issue but solved just by putting the word 'LOCAL' (LOAD DATA LOCAL INFILE), but that gives me this error:
Error Code: 1148. The used command is not allowed with this MySQL version 0.000 sec
(I'm using MySQL Workbench 8.0)
So I tried to set some global variables like secure-file-priv="", loose-local-infile=1 and local-infile=1 in my my.ini file, but nothing seems to work.
Can anyone help me please...
Ps 1: I can't use the wizard import because even though it would work, it's too slow
Ps 2: I tried to convert my txt file to csv but it didn't work either.
Without LOCAL, LOAD DATA INFILE tells the MySQL server to find the file on the file system of its own machine and read it.
So, the path and file have to exist on the server machine. And, the credentials (the username) under which the MySQL server runs must have read access to the file.
Your permission denied error hints to me that the MySQL server can't read the file.
The OP had 2 problems:
a) mysql did not have access to the input file from a permissions perspective
b) the input file was not correctly encoded.
Once the access issue was resolved and the input file encoding had been corrected to utf8, the load worked correctly.

Create tablespace "error in creating database file, access denied (OS 5)"

I try to create a database file. I've checked the route and everything, I've tried several times to create the tablespace (I've changed to capital letter, the ' for "...) like this...
create tablespace uinstitucion datafile 'C:\app\uinstitucion\oradata\uinstitucion\uinstitucion.dbf' size 500M ;
file create error, unable to create file", "unable to open file", "(OS 5) access denied" (but I am logged as SYSTEM!)
... as you can see, I was just lead to several errors. What can I do? What am I doing wrong? I'm desperate since yesterday, and my teacher does not seem to notice the exact error.
I've also tried the order like
CREATE TABLESPACE lmtbsb DATAFILE 'file_path/lmtbsb01.dbf' SIZE 50M
EXTENT MANAGEMENT LOCAL AUTOALLOCATE;
but it leads me to the same error.
I'm sorry I cannot post a picture, it would be more descriptive, but I am not allowed yet.
Please run your SQLplus as an administrator and then connect and try to execute it.
You error says that you have no privileges to create file. This comes from operating system. Path looks for Windows so please try right click on SQLplus (or any other client you're using), choose run as administrator and then continue.

MySQL cannot read error file

Important info first: I am on OS X 10.7.5 and trying to work with the newest version of MySQL.
I try to start the MySQL server and I've been getting the error code
ERROR! The server quit without updating PID file (/usr/local/mysql/data/<insert my
username here>.local.pid).
I found a website that says that this just says, in essence "Hey, there's an error here and it's in the error file."
Trouble is, I can't seem to actually read the !*%?!# error file. I used sudo chmod u+x to alter the file to give me the permission to open it (I couldn't before), but it's a .exe now and there isn't actually a program to open it to read it, even though the "kind", as the finder calls it, is actually a document.
I have tried easily 20+ tricks to try and grant the permissions correctly, and still I can't seem to figure out what's wrong. I'm assuming the actual answer is in the error log. How do I open it? And then what do I do when I've actually opened the log?

Dumping a database table to text file

I am trying to dump a table from MySQL database into a text file by running the following query
SELECT fields FROM text_file_table INTO OUTFILE 'C:\\Program Files\\textfile.text'
But it gives me the error
Cant create/write to file "C:\Program Files\textfile.text"
I think it is due to security issue, that it is not allowing the DBMS to write the file on that directory. If there can be any other issue, please let me know, and also help me finding solution to the problem. And I am doing this on Windows Server 2008. Thanks!
There could be two issues. The command runs in the operating system as 'mysql' so the 'mysql' user may not have permission to write in c:\Program Files. It shouldn't, so that's good. If you change your target path to somewhere that you can write to, this problem will go away.
The other issue is that the user you are logged in as inside mysql may not have the privilege to read and write files - see http://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html#priv_file. If this is the problem, you'll have to GRANT the privilege to your user.
I think problem is with the path . if you are using windows
the filepath sould be like this in the query
'C:/Program Files/textfile.txt'
OR try this , i am not sure
'C:\Program Files\textfile.txt'
also use txt inside of text in the file name => textfile.text

LOAD DATA LOCAL INFILE only works sometimes

I have a LOAD DATA command that works fine in the MySQL terminal. It works fine in a test PHP file served from my local server. It works fine in phpMyAdmin on the same server. It inexplicably breaks down when run from Magento, also on the same server.
I have confirmed all methods are using the same login credentials. If I copy the failed command (including all previous queries from connection onwards) from the query log and paste into any other method it mysteriously works again. The query itself cannot be at fault.
Therefore I deduce the problem must be a permissions one. File privilege is set and works for other implementations on the same account. Magento is using pdo_mysql as it's connection. If I duplicate that in a test file it works. Magento must be setting some parameter that is interfering.
The error I get is SQLSTATE[42000]: Syntax error or access violation: 1148 The used command is not allowed with this MySQL version. I must use the "LOCAL" modifier keyword because I cannot guarantee the database server will be accessible.
The nearest previous question here on SO concerns drupal, the error is different but I recall drupal also uses pdo_mysql to connect, perhaps it is related. The only other mention of this error on Magento is this thread which also fails on a LOAD DATA LOCAL INFILE command.
Per #DeveloperChris' suggestion, you can enable SQL logging in Magento in the Varien_Db_Adapter_Pdo_Mysql class (in the lib\Varien path). Change the $_debug and $_logAllQueries class variables to true. You can also change the file path where the queries are logged in $_debugFile.
Don't forget to turn it off before production!
HTH,
JD