How to login with mysql.exe, without command line - mysql

If it's possible, what command can be used to login to Mysql, without using cmd.exe, and by just running mysql.exe without any parameters? I don't need this, but I really don't like using the command line to login.

Related

what should i do to run 'mysql --versi' command in my terminal

What should I do to run the 'mysql --version' command in this way and not get an error?
I want to code MySQL via VS Code. What do I need for this? I did some research, but the commands are constantly given to the terminal using the 'mysql' command. But when I type this command, I get an error like this. Could you help. My goal is to code MySQL on VS Code.

Delphi + MySQL command line

I'm building a tool using Delphi and MySQL to restore a script generated with MySQLDump.
It was supposed to load and execute a SQL file and log any possible errors into a given output file.
I thought about execute the mysql command line and send command lines but i don't know if its possible ou how to do it since I just know how to call mysql using windows cmd and execute a single command line using ShellExecute or CreateProcess
I tried to do it with a single command line but it did'nt logged the errors properly
I tried this:
cmd /c mysql.exe --user root < "C:\restore.sql" > "C:\restore_log.txt"
the content of restore.sql was:
drop database test;
It does execute my script, but on the second attempt it should log "database doesn't exist" but restore_log.txt was empty
It would help if anyone could point the way to call mysql and send multiple lines OR a help with my cmd line to log properly
Anyone can help me?
I don't know what components you've got available to connect to the MySQL db, but using TADOQuery to access SQL Server, I simply load up the queries into a TADOQuery's .SQL property and then call Open or ExecSQL. As long as it's just vanilla SQL that was generated by SQLDump, I'd guess that should work. It's worth a try anyway.
digging more at stackoverflow I found previous answers that helped, the difference is that the output goes to a Memo that I can save to a file.
Thank you all for the help and the insights.
The answers can be found on the following links:
Getting output from a shell/dos app into a Delphi app
How do I run a command-line program in Delphi?
Getting output from a shell/dos app into a Delphi app

Options for secure connection to mysql from bash script

I am trying to execute a few mysql statements in bash script. The script connects to mysql and does all the required work. But, it gives me a warning
Warning: Using a password on the command line interface can be insecure.
I understand that passwords and usernames must not be used directly in the script, which I have currently done
What other options do I have in order to not have this warning coming up? Can I have a file with the key:value pairs for host,dbname,username and password and then use the file for connection details in the script?
Thanks in advance
Rathi
During the init phase of your script, I would ask the user for host, username and password. Then forward these variables to the mysql command.
See here where you can learn how to ask the user for content without echoing it on the terminal window.

Connecting to mysql from cygwin issue

I am trying to debug something larger and I noticed that I can not properly connect to mysql from cygwin. I run the command by providing the host, user and password, and the only output is the error:
Warning: Using a password on the command line interface can be insecure.
after which it just idles.
interesting is that when i run
which mysql and I go to that path with the command prompt from windows and run the same command everything is ok.
Some console applications that weren't compiled using Cygwin may work incorrectly inside Cygwin's terminal. MySQL client is probably one of them. To use MySQL client with Cygwin, I'd install one from official Cygwin's repositories rather than trying to use native Windows MySQL. (Note that this doesn't mean installing whole server, just the client.)

How to work with emacs and mysql

I'm getting the message unable to locate SQL program 'mysql' when I attempt to enter sql mode in Emacs. However, I'm able to access mysql just fine via terminal.
For the record, I'm using user and password as root, server as localhost and a database of my choosing. I just don't know why this is happening.
Ideas?
Emacs uses the directories listed in the exec-path variable to look for programs. You can add to it like so:
(add-to-list 'exec-path "/usr/local/bin")
The following shell command should give you the correct value to use:
dirname `which mysql`