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.
Related
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
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';
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,
I just installed SQL Server 2008, and I wanted to use the command editor to execute queries.
To do that I opened the command prompt, and I typed
Sqlcmd -S Serverinstance
but I got an error saying :
Named Pipes Provider: Could not open a connection to SQL Server [53].
Sqlcmd : erreur : Microsoft SQL Server Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
Sqlcmd : erreur : Microsoft SQL Server Native Client 10.0 : Login timeout expired
What should I do to get it connected to the server so I can proceed?
Thank you :D.
(This one is going to sounds silly) my problem was that I wasn't using capital 'S'
Eg:
C:\> SQLCMD -S localhost\sqlexpress
You need to either use the integrated-security approach of using your Windows credentials to connect to SQL Server by specifying -E as an option:
C:\> SQLCMD -S Serverinstance -E
or then you need to define a user/password set to achieve a SQL Server login:
C:\> SQLCMD -S Serverinstance -U (login in) -P (password)
All the many SQLCMD parameters are well-documented on MSDN SQL Server Books Online!
The server you are specifying cannot be found or is not accessible. so either the server is wrong (have you spelt it correctly) or you are not specifying it correctly or it is not accessible from your machine.
After you've got that right, you will need to specify a username/password or a -E command qualifier for a Trusted Connection. You may also need to specify the database with a -d qualifier.
You can get help by typing
Sqlcmd -?
Can I run mysql delete row remotely from other machine?
Something alike mysqldump which run locally dumping data on other remote machine.
try:
mysql -u yourdblogin -pyourdbpassword -h yourdbdomain.yourdomain.com yourdb -e "delete from table where x = y"
not sure if -e is the correct argument, but the though is sound.
Only if you have TCP connections configured on the MySQL server, and you have a username and password configured that will allow you to remotely connect.
If you check the mysqldump documentation, you'll find the -host option allows you to connect to a remote system.
You can try something like this:
mysql -u yourdblogin -pyourdbpassword -h yourdbdomain.yourdomain.com yourdb
Sorry if I misunderstood your question.
The specific way of doing this is to connect to the remote machine using the mysql prompt and then execute queries against it (queries which cause a row to be deleted.)
# mysql -u username -p -h remote.location.com
mysql> USE `database_name`;
mysql> DELETE FROM `table` WHERE id=1234;
The DELETE FROM syntax is SQL syntax, and the WHERE part of it allows you to specific exactly what you want to be deleted.
Also, you most likely won't be able to log in as 'root' if you're used to doing so, as root by default can't connect remotely. (You can enable this, but it's recommended instead to make another admin account and to use that instead).
Note that code may also remotely delete rows, however it depends on the language and implementation as to how it's done.
References:
MySQL DELETE Syntax
MySQL SELECT Syntax (includes details about WHERE)
You can actually use any MySQL client application to connect to remote servers, not only the supplied command-line tool.
If the server allows TCP client connections, there are no differences between running scripts locally or remotely.
If the MySQL server happens to be also a web server, you can use a software like PHPMyAdmin to do it. Once it runs locally (on the same machine as the MySQL server, not your machine), you can work around the problem of not accepting external TCP connections, if the server was configured that way.