Is there any nice command line MySQL client for windows? I mean a single exe that allows connecting and running a sample query. I’ve googled and only could find big graphical environments like toad or mysql workbench. I need only a simple command line tool, where can I download sth like this?
EDIT: I don’t want to install the whole MySQL package on my PC. I know it’s inside the mysql package but how do I download only this cmd line client. Because i don’t need anything else.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
When you go to the MySQL download page, choose the platform “Microsoft Windows”. Then download the “Windows (x86, xx-bit), ZIP Archive” (be sure to select the one with size over 140M.
The binaries will be in the “bin” folder.
I understand that this is not just the client binaries, but at least you don’t have to install and setup the entire server.
Method 2
mysql.exe can do just that….
To connect,
mysql -u root -p
(press enter)
It should prompt you to enter root password (u = username, p = password)
Then you can use SQL database commands to do pretty much anything….
Method 3
You can choose only install the client during server install. The website only offers to let you download the full installer (grab whatever version you want from http://www.mysql.com/downloads/mysql/).
In the install wizard, when prompted for installation type (typical, minimal, custom), choose ‘Custom’. On the next screen, select to NOT install the server, and proceed with the rest of the install as normal.
When you’re done, you should see just the relevant client programs (mysql, mysqldump, etc) in C:Program FilesMySQL..bin
Method 4
Its pretty simple. I saved the mysql community server in my D:
drive. Hence this is how i did it.
Goto D:mysql-5.7.18-winx64bin
and in the address bar type cmd and press enter, so command prompt will open. Now if you’re using it for the first time type as mysql -u root -p
press enter. Then it will ask for password, again press enter. Thats it you are connected to the mysql server.
Before this make sure wamp or xampp any of the local server is running
because i couldn’t able to connect to mysql wihthout xampp running.
Happy Coding.
Method 5
You can also download MySql workbench (31Mo) which includes mysql.exe
and mysqldump.exe
.
I successfully tested this when i had to run Perl scripts using DBD:MySql
module to run SQL statements against a distant MySql db.
Method 6
You can access mySQL in command line just by typing:
C:wwwmysqlbin> mysql -u root -p
After which you can type sql commands normally such as:
mysql> SHOW DATABASES;
Here, I am assuming you mySQL installation directory is C:wwwmysql
.
Method 7
I have similar requirement where I need a MySQL client but not server (running in a virtual machine and don’t want any additional overhead) and for me the easiest thing was to install MySQL community server taking typical installation options but NOT configure the server, so it never starts, never runs. Added C:Program Files (x86)MySQLMySQL Server 5.5bin to system path environment variable and I’m able to use the MySQL command line client mssql.exe and mysqladmin.exe programs.
Method 8
If you are looking for tools like the the mysql and mysqldump command line client for Windows for versions around mysql Ver 14.14 Distrib 5.6.13, for Win32 (x86) it seems to be in HOMEDRIVE:Program Files (x86)MySQLMySQL Workbench version
This directory is also not placed in the path by default so you will need to add it to your PATH environment variable before you can easily run it from the command prompt.
Also, there is a mysql utilities console but it does not work for my needs. Below is a list of the capabilities on the mysql utilities console in case it works for you:
Utility Description ---------------- --------------------------------------------------------- mysqlauditadmin audit log maintenance utility mysqlauditgrep audit log search utility mysqldbcompare compare databases for consistency mysqldbcopy copy databases from one server to another mysqldbexport export metadata and data from databases mysqldbimport import metadata and data from files mysqldiff compare object definitions among objects where the difference is how db1.obj1 differs from db2.obj2 mysqldiskusage show disk usage for databases mysqlfailover automatic replication health monitoring and failover mysqlfrm show CREATE TABLE from .frm files mysqlindexcheck check for duplicate or redundant indexes mysqlmetagrep search metadata mysqlprocgrep search process information mysqlreplicate establish replication with a master mysqlrpladmin administration utility for MySQL replication mysqlrplcheck check replication mysqlrplshow show slaves attached to a master mysqlserverclone start another instance of a running server mysqlserverinfo show server information mysqluserclone clone a MySQL user account to one or more new users
Method 9
mysql.exe is included in mysql package. You don’t have to install anything additionally.
Method 10
download the mysql-5.0.23-win32.zip (this is the smallest possible one) from archived versions in mysql.com website
cut and paste the installation in c drive as mysql folder
then install then follow instructions as per this page:
https://cyleft.wordpress.com/2008/07/20/fixing-mysql-service-could-not-start-1067-errors/
Method 11
For Windows users:
1.Install the full version of MYSQL
2.On the Windows 10 start button click on search and type in MySQL
3. Select the MYSQL Command Line Client 5.5 (I am using version 5.5)
4. go ahead and run your sql queries/
5. to exit type q or quit
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0