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

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.

Related

Why is there an error with the source command in MySQL

I'm trying to add the employee sample database for practicing with MySQL however there's an error since there's a source command and from what I've found it says that MySQL doesn't support this command anymore.
So, how could I add the complete database without any error?
[this is the code line where the source command is called]
SOURCE is one of the mysql client builtin commands. These are recognized by the mysql client, but not by the MySQL Server's SQL parser.
See https://dev.mysql.com/doc/refman/8.0/en/mysql-commands.html

How to change MySQL JS> to only MYSQL?

I did custom installation for MYSQL and only included MySQL shell, server, and python connector but I don't know from where Java script came from and because of that I can't connect python and Mysql.
Please help
Just switch the execution mode to sql. Like sql.
[1. write " \sql " (this will convert SQL-JS to sql ]
2. write as shown in the image
\sql
\connect root localhost

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

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`

How to login with mysql.exe, without command line

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.