skip-secure-auth option not working with mysqldump - mysql

I am trying to export a mysql schema from remote server to local but geting the following error:
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysqldump --skip-secure-auth -h x.y.z.d -uatulya -p'root' t_tcadmin |mysql -u root -proot t_tcadmin
mysqldump: unknown option '--skip-secure-auth'
Warning: Using a password on the command line interface can be insecure.
Without the --skip-secure-auth it connects but I get error 2049.
So I want to use this option to skip secure auth but it is giving the above error. Could anyone suggest.
Thanks..

If you are in a pinch, dealing with an older server where updating the passwords to the newer method is not an option (say, MySQL Server v5.0.95) and attempting to migrate the data to a newer system - without modifying the fragile older system, you may need to temporarily downgrade your local mysql client to 5.5 for myasqldump to be able to talk to the older server. As of 5.6 it is possible to use the MySQL client to connect to it - using --skip-secure-auth in the command, but mysqldump will not accept that flag. And, in MySQL 5.7+ it is impossible to connect to a server that uses the older password storage method at all.

Related

MySQL CLI Client shows data as Hex

My MySQL CLI client when connecting to a database is automatically showing the data as hex
Connecting in CLI using mysql -u user -p'password' -h host -P port --ssl-mode=DISABLED
To turn this off I have to run it with the --skip-binary-as-hex option to see the data properly
Need help understanding what is causing this is getting enabled by default.
This issue does not exist for other users logging into the same database and is not an issue for me I connect through a DB tool, it occurs only on CLI
Prior to MySQL 8.0.19, the issue which you are facing did not exist. binary-as-hex client option is enabled by default from MySQL 8.0.19 Command Line Client.
Run status or \s in MySQL Command Line Client. You will notice a line about binary data like this:
Binary data as: Hexadecimal
You can refer these links for more information:
https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_char
https://dev.mysql.com/doc/refman/8.0/en/mysql-command-options.html#option_mysql_binary-as-hex

MySQL CLI: unknown option: enable-cleartext-plugin

This question has been asked a couple of times out here, but I'm not able to enable cleartext plugin. I'm using mySQL CLI to access an RDS(Engine version: 5.7.26) instance using the command
mysql -h $RDSHOST -u <Username> --password=$TOKEN --enable-cleartext-plugin --port=3306 --ssl-ca=<path to pem file>
I get the following error:
mysql: unknown option '--enable-cleartext-plugin'
I installed mySQL by running yum install curl mysql -y. But in the logs I see maria-db being installed, is there something wrong out here. Thanks in advance.
Note: If you're using a MariaDB client, the --enable-cleartext-plugin option isn't required.
According to the article found here: https://aws.amazon.com/premiumsupport/knowledge-center/users-connect-rds-iam/
tl;dr: do not use the mariadb client to connect to an AWS RDS instance using IAM Authentication.
Here's a quick answer for your issue, and another for the one you'll hit after removing the flag:
You are definitely running a mariadb client, you can confirm it with mysql --version.
On the paper mariadb always enable plugins, thus does not provide the enable-cleartext-plugin flag on the client.
However —after losing several hours yesterday on the same issue— it appears that the client does not even use the cleartext plugin when you try to authenticate against a AWS RDS instance with IAM Authentication (tested with mariadb 10.3 and 10.5 clients against a MySQL 8.0.23 server).
In the end you must use the 'official' mysql client for this usecase. Some linux distributions provide this client through another package like Percona-Server (which is the case for Arch Linux and Exherbo at least).
For me I had to re execute this then I could login with the special user:
ALTER USER 'myuser' IDENTIFIED WITH AWSAuthenticationPlugin as 'RDS';

Where can I run a mysql command line under Azure to fix "The used command is not allowed with this MySQL version (1148)"

I have a MySQL database which is hosted in Azure, and I have MySQL Workbench installed on my laptop. I want to do some importing from a CSV file located in my laptop, but whenever I try to that, I get an error message saying:
The used command is not allowed with this MySQL version
I did some online searching, and I found out that I need to run the following command:
mysql -u myuser -p --local-infile somedatabase
But, I don't know where I have to run it, and how, while as I said my database is hosted in Azure.
mysql is just the commandline executable of the MySql client. And most probably it is even part of the MySql workbech - just check the MySQL Workbech working folder. But the result will not be different is my guess.
The best way you can manage Import/Export for MySQL is to use a Free Tier WebSite and Install the phpMyAdmin extension.

How can I correct MySQL Load Error

I'm not quite sure a similar question to this was closed by I'm trying to execute the following MySQL program.
mysql -e "load data local infile \
'/tmp/ept_inventory_wasp_export_04292013.csv' into \
table wasp_ept_inv fields terminated by ',' \
lines terminated by '\n' ;"
at the bash command line and get this error
ERROR 1148 (42000) at line 1: The used command is not allowed with this MySQL version
How can I work around this problem?
I am actually running this command from a Python program, but pulled the command out to try fiddling with it at the bash command line.
I've seen how I can modify my.cnf (local-infile), but I do not want that global a change if I can avoid it.
Here's the MySQL version.
mysql Ver 14.14 Distrib 5.5.31, for debian-linux-gnu (i686) using readline 6.2
The workaround for this is to modify the command line mysql -e to pass in the --local-infile=1 argument like this:
mysql --local-infile=1 -u username -p `
Then run the LOAD DATA LOCAL INFILE command again.
As documented under Security Issues with LOAD DATA LOCAL:
To deal with these problems, we changed how LOAD DATA LOCAL is handled as of MySQL 3.23.49 and MySQL 4.0.2 (4.0.13 on Windows):
By default, all MySQL clients and libraries in binary distributions are compiled with the --enable-local-infile option, to be compatible with MySQL 3.23.48 and before.
If you build MySQL from source but do not invoke configure with the --enable-local-infile option, LOAD DATA LOCAL cannot be used by any client unless it is written explicitly to invoke mysql_options(... MYSQL_OPT_LOCAL_INFILE, 0). See Section 20.6.6.49, “mysql_options()”.
You can disable all LOAD DATA LOCAL statements from the server side by starting mysqld with the --local-infile=0 option.
For the mysql command-line client, enable LOAD DATA LOCAL by specifying the --local-infile[=1] option, or disable it with the --local-infile=0 option. For mysqlimport, local data file loading is off by default; enable it with the --local or -L option. In any case, successful use of a local load operation requires that the server permits it.
If you use LOAD DATA LOCAL in Perl scripts or other programs that read the [client] group from option files, you can add the local-infile=1 option to that group. However, to keep this from causing problems for programs that do not understand local-infile, specify it using the loose- prefix:
[client]
loose-local-infile=1
If LOAD DATA LOCAL is disabled, either in the server or the client, a client that attempts to issue such a statement receives the following error message:
ERROR 1148: The used command is not allowed with this MySQL version
local-infile needs to enabled on both the server and the client. You can accomplish this by adding local-infile = 1 to the appropriate section in each end's my.cnf (Unix) or my.ini (Windows) file. For example, on the client:
[client]
local-infile = 1
You can also enable this at runtime on the server by setting the system variable local_infile:
SET GLOBAL local_infile=1;
However, you still need to enable it on the client. You can do this at runtime by adding a command-line parameter to the mysql command:
mysql --local-infile=1 ...
If you're using Amazon Web Services RDS, you can configure the server setting by editing or creating a Parameter Group. Look for the local_infile parameter. You may need to restart your server after applying the changes.
My guess is that your MySQL server does not have LOAD DATA LOCAL enabled. See this section of MySQL documentation:
If LOAD DATA LOCAL is disabled, either in the server or the client, a client that attempts to issue such a statement receives the following error message:
ERROR 1148: The used command is not allowed with this MySQL version
Here is link to the page I got this from:
http://dev.mysql.com/doc/refman/5.5/en/load-data-local.html

mysql workbench ssh custo command

I'm trying to configure a new connection through SSH tunnel.
But on the server, the command mysql does not exists. I have my own compilation called custo-mysql.
I mean, when I'm on the server, I use the following command :
$ custo-mysql -u root -pmypassword
How can I tell workbench to use custo-mysql and not mysql ?
mysql (and your custo-mysql) is a client for the server. Workbench is a client as well, so it doesn't need to use that custo-mysql thing. It just connects to your server.
Basically, on your server you have a "mysqld" running: a mysql server. Your commans custo-mysql connects to that server as a sort of interface. Workbench has the exact same function, so it should work if your networking/tunneling etc is correct.
As #Nanne already mentioned, you don't need the mysql client to connect to your MySQL server using Workbench.
I would just like to point out that Workbench does use the mysql command line client for importing databases in the Admin / Data Import/Restore section. Having said that, you'll certainly be OK without it for everything else.
Cheers,