MySQL CLI: unknown option: enable-cleartext-plugin - mysql

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';

Related

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.

Cannot connect to MySQL Workbench on mac. Can't connect to MySQL server on '127.0.0.1' (61) Mac Macintosh

Cannot connect to MySQL Workbench on mac. I get the following error: Could not connect, server may not be running. Can't connect to MySQL server on '127.0.0.1' (61)
The help would be appreciated.
Thank You!
Ran into a similar issue and my problem was that MySQL installed itself configured to run on non-default port. I do not know the reason for that, but to find out which port MySQL is running on, run the following in MySql client:
SHOW GLOBAL VARIABLES LIKE 'PORT';
Go to System preferences -> MySql and check the state of your MySql instance.
There may be one or multiple reasons if you are not able to connect to MAC OS X MySQL server with MySQL-workbench.
When you press 'test connection' you might see this error. This could be explained briefly if you go step by step through 'Configure server management..'
On the basis of the red crosses you can filter out the real problem.
The most common problems are associated with the installation of MySQL-server. Few people either forget to install the server prior to installing MySQL-workbench. Some others would install a part of the product. Please check whether you have also installed all the 3 parts that comes with the MySQL-Server dmg(disk image) file which contains mysql-server package. Those 3 parts are: MySQL server, preference pane and startup item.
Note: If you haven't selected preference pane then you won't be able to start mysql server instance from the System preferences.
After you make sure that you have installed each item then you can check server instance of your native mysql-server. Open System preferences from dock and click MySQL. Then click Start MySQL Server to start the server instance. If the server instance is stopped, then MySQL-workbench won't be able to connect to the MySQL server.
If you are still facing issue, then you need to check the port of the connection which you are making. Default port is '3307' and NOT '3306'. You can check it with using the following command in mysql terminal:
SHOW GLOBAL VARIABLES LIKE 'PORT';
Please note that this process helps you to connect to the local instance. If you have to connect to a remote server, then you have to enter that specific IP and Port. Contact your server's administrator if you are facing the issue. As this question specifically states that the problem is related to connecting to the local instance, I am not writing checks that you may need to ensure.
This steps are all in the terminal:)->source
Step make sure your server is running:
sudo /usr/local/mysql/support-files/mysql.server start
Check MySQL version. "This also puts you in to a shell interactive dialogue with mySQL, type q to exit."
/usr/local/mysql/bin/mysql -v
Make your life easier: "After installation, in order to use mysql commands without typing the full path to the commands you need to add the mysql directory to your shell path, (optional step) this is done in your “.bash_profile” file in your home directory, if you don’t have that file just create it using vi or nano:"
cd ; nano .bash_profile
paste in and save:
export PATH="/usr/local/mysql/bin:$PATH"
"The first command brings you to your home directory and opens the .bash_profile file or creates a new one if it doesn’t exist, then add in the line above which adds the mysql binary path to commands that you can run. Exit the file with type “control + x” and when prompted save the change by typing “y”. Last thing to do here is to reload the shell for the above to work straight away."
source ~/.bash_profile
mysql -v
"You will get the version number again, just type “q” to exit."
Check out on which port the server is running:
in your terminal type in: mysql
and then
SHOW GLOBAL VARIABLES LIKE 'PORT';
use everytime a semikolon in the mysql client (shell)!
now you know your port and where you can configure your server(in the terminal with mysql shell/client). but for a successful connection with MySQL Benchmark or an other client you have to know more. username, passwort hostname and port. after the installation the root user has no passwort so set(howtoSetPW) the passwort in terminal with mysql shell/client. and the server is running local. so type in root, yourPW, localhost and 3007. have fun!
Try restarting the mysql or starting it if it wasn't started already. Type this within terminal.
mysql.server restart
To auto start go to the following link below:
How to auto-load MySQL on startup on OS X Yosemite / El Capitan
In my case I had a previous mySQL server installation (with non-standard port), and I re-installed to a different directory & port. Then I got the same issue (in windows). To resolve, you click on home + add new connection.
If you need to know the port of your server, you can find it when you start My SQL command line client and run command status (as below). In windows it is via All Programs -> MySQL -> MySQL ServerX.Y -> MySQL X.Y Command Line Client
I had the same issue, I solved this with the following steps:
Install the MySql (DMG) from this link
If the mysql package comes with the file name "mysql-5.7.13...." and
"MySql.prefPane" then your life is really easy.
Just click on "mysql-5.7.13...." and follow the instructions.
After the installation is done, click on "MySql.prefPane" and checkout "Only
for this user" in the popup. We use "MySql.prefPane" to start the mysql
server as this is really imp because without this you will end up having
errors.
Click on Start MySql Server in the next dialog box.
OR
If you don't see "MySql.prefPane" in the package then follow these steps:
Click on package "mysql-5.7.13...." and this will show you one password as
soon as installation is done. That password is use to start the connection.
You can change it. I will let you know in a while.
After installation save the password (this is really important - you'll need it later), open terminal.
$ cd /usr/local/mysql/bin/
$ ./mysql -u root -h localhost -p
And then type the password from above. This should start mysql>
To change the password:
$ cd /usr/local/mysql/bin/
$ ./mysqladmin -u root -p password 'new_password'
Enter Password: <type new password here>
$ ./mysql -u root -h localhost -p
... and log in with the new password.
After this you can go to MySql workbench and test connection. It should connect.
brew services start mysql defualt set --bind-address=127.0.0.1 with /usr/local/Cellar/mysql/5.6.27/homebrew.mxcl.mysql.plist,so replace --bind-address=127.0.0.1 with --bind-address=* or --bind-address=0.0.0.0
for mac : check the compatible version of mysql server in workbench>preference>MySql
if it's the same version with your mysql server in: cd /usr/local/
I am using those commands on MacOs after getting the same error
sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart
I had the same problem. I removed mySQL completely, and reinstall it using homebrew.
I had same problem, but it worked for me.
check if you have mysql installed
If you don't have mysql installed, download from this link: https://dev.mysql.com/downloads/mysql/
follow this instructions to install
https://dev.mysql.com/doc/mysql-osx-excerpt/5.7/en/osx-installation-pkg.html
You can test the connection without any problem.
(Sorry for my english, I agree fix me please)
I Hope I've helped.
Greetings.
I ran into the same scenario
I opened "System Preferences", clicked "MySQL", then clicked "Initialize Database" button. I entered a new password and saved it in a safe place.
After that i restarted the MySql Instance (in the System Preferences dialog as well).
After that i opened MySqlWorkbench and opened the default connection, entered the password i set before and: Viola, i can do whatever i want :-)
I had this same issue on Monterey. Make sure you're selecting the correct download according to your processor architecture.
Community download processor architecture
Also, for the Connection Method use the Local Socket/Pipe
connection method
Dropping this to share my experience.
I had the same problem and realise I didn't start MySql server.
The steps below shows how I was able to login:
To start your server, Go to Preference and find MySql.
Click on the instance tab to start the server
Afterward, return back to Mysql Workbench to start the Local Instance and you'll be connected.
Have fun !
I had similar issues in Mac OS Catalina and the easiest way to solve it is by downloading HOMEBREW package manager for mac. Follow the steps to install HOMEBREW and mysql server.
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install mysql
$ brew tap homebrew/services
$ brew services start mysql
mysqladmin -u root password 'yourpassword'
Now try using mySQLworkbench it should work.

skip-secure-auth option not working with mysqldump

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.

Can't Connect to Local Mysql from terminal

NOTE: The full discussion to the answer in this question is in a chat link in the comment section below, above the submitted answers.
The summarized answer is in checked answer.
After meddling with installing the gem for mysql2 and successfully doing that I type
which mysql
and it returns
mysql: aliased to nocorrect mysql
I'm not sure what this means.
Then I type in
mysql --version
and it outputs
mysql Ver 14.14 Distrib 5.5.20, for osx10.7 (i386) using readline 5.1
So I know mysql is installed.
Finally I want to configure a database for my rails app so, from within the correct directory I type:
mysql -u root -p
It asks me for a password and, since there is none, I leave it blank. It outputs this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I've been reading around for a solution but I don't understand any of them. Like finding a file called my.cnf or a folder called etc within the rails framework files...
It's trying to connect over unix sockets instead of tcp/ip. Try adding -h param eg
mysql -h localhost -u root -p
edit: Just read your question a bit closer. "mysql" being installed just means you have a client, not the server itself. Check you have mysqld installed.
mysql --socket=/var/lib/mysql/mysql.sock -u root -p
also read this
Here is what finally allowed me to create a freaking database in my rails apps through terminal after dealing this error.
I downloaded mysql's .dmg 64 bit version from here:
http://dev.mysql.com/downloads/mysql/
and then I followed the instructions in the README file. That was the most important part.
Thanks for the help everyone.
EDIT:
This didn't answer the question entirely for me since mysql stopped working.
After installing .dmg version I had to update the bash_profile file.
Here is where the instructions are:
Should I reinstall Mysql?

connecting mysql through command prompt

I have query regarding connecting mysql to comand prompt.
I did:
open cmd prompt
telnet localhost com 3306
I RECEIVED REPLY as---
some instructions mentioning
telnet [-a][-e escape char][-f log file][-1 user][-t term][host [port]]
-a attempt automatic logon. same as -1 option except uses the currently logged on user's name.
-e Escape char to enter telnet client prompt.
and some more...
but is it right?? or i am lost???
kindly help.
do not telnet to your mysql database.
Instead use the mysql command, a UI like db visualizer (they have a pay version and a free version), or the free ui that comes with maria db (a drop in replacement for mysql).
more more info on the mysql command, try running mysql --help or find it in the mysql reference manual
Edit: more info added here.
Telnet is not a "command prompt", it is a communication protocol (check out telnet protocol on wikipedia) and a program (that uses the communication protocol to communicate). You can not connect to mySql with telnet because mySql does not use the telnet protocol for communication.
I have only accessed mySql for jdbc, so I'm not sure how to solve your problem. I know there is a c api interface for mySql as well. Sections "20 Connectors and APIs," and "15 Replication" in the mysql reference might be helpful.