mysql is not recognised as an internal or external command,operable program or batch - mysql

I had set the MySQL path, but still getting the same error. Please let me know whether I followed the correct one or not.
MySQL location is: C:\Program Files\MySQL\MySQL Server 5.0\bin
In Windows, system variables I had set the path as:
variable name: MYSQL_HOME
variable value: C:\Program Files\MySQL\MySQL Server 5.0\bin
For PATH setting:
variable name: PATH
variable value: .;%JAVA_HOME%\bin;%MYSQL_HOME%\bin...
If it is not the correct one, please let me know the correct path and its settings.

Simply type in command prompt :
set path=%PATH%;D:\xampp\mysql\bin;
Here my path started from D so I used D: , you can use C: or E:

MYSQL_HOME variable value=> C:\Program Files\MySQL\MySQL Server 5.0\bin
%MYSQL_HOME%\bin
See the problem? This resolves to a path of C:\Program Files\MySQL\MySQL Server 5.0\bin\bin

MYSQL_HOME:
C:\Program Files\MySQL\MySQL Server 5.0
Path:
%MYSQL_HOME%\bin;

Here is what I DO on my PC, I install all software that I usually used in G: partition not C:
if my operating system is fall (win 10), Do not need to reinstall them again and lose time, Then How windows work it update PATH automatic if you install any new program or piece of software,
SO
I must update PATH like these HERE! all the software I usually used
1- I created a folder called Program Files
2- I install all my programs data in this folder
3-and then going to PATH and add it Don't forget ;
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;G:\HashiCorp\Vagrant\bin;G:\xampp\php;G:\xampp\mysql\bin;G:\Program Files (x86)\heroku\bin;G:\Program Files (x86)\Git\bin;G:\Program Files (x86)\composer;G:\Program Files (x86)\nodejs;G:\Program Files (x86)\Sublime Text 3;G:\Program Files (x86)\Microsoft VS Code\bin;G:\Program Files (x86)\cygwin64\bin

MySQL location is: C:\Program Files\MySQL\MySQL Server 8.0\bin
In Windows, system variables I had set the path as:
variable name: MYSQL_HOME
variable value: C:\Program Files\MySQL\MySQL Server 8.025\bin
For User variable for user:
Click Path ---> NEW ---> C:\Program Files\MySQL\MySQL Server 8.0.25\bin
Click OK
Now check with cmd (mysql -V)
You may get a command like this
mysql Ver 8.0.25 for Win64 on x86_64 (MySQL Community Server - GPL)
You're DONE.

I am using xampp. For me best option is to change environment variables. Environment variable changing window is shared by #Abu Bakr in this thread
I change the path value as
C:\xampp\mysql\bin;
and it is working nice

You only have to set path in the system variables and you are done with the job. Here I will show you step by step:
Step1: Go the start taskbar and write environment and click on the edit system environment option:
Step2: After clicking a dialog box namely System Properties Will occur like this:
Step3: Click on environment variables and then inside system variables in which there is written path, double click on path a new dialog box namely edit environment variables will be pop up as shown:
Then add the address of the MySql bin in windows C the path by clicking new path option, in my laptop MySql was here so added this path C:\Program Files\MySQL\MySQL Server 8.0\bin, thats it click ok and run on command prompt mysql --version command and it will show the actual version of mysql installed at your pc

In my case, it turned out to be a simple case of spacing.
Turns out, i had a space inserted after the last ; and before ""C:\Program Files\MySQL\MySQL Server 5.7"
For this very simple reason, no matter what i did, MySql was still not being recognized.
Once i eliminated the spaces before and after path, it worked perfectly.
In retrospect, seems like a very obvious answer, but nobody's mentioned it anywhere.
Also, i'm new to this whole windows thing, so please excuse me if it sounds very simple.

You can fix in 3 steps
you have to change course by
first > Copy file path
*my path is E:\Program\xampp\mysql\bin*
next in CMD I write the followin
that
set path=%PATH%;set path=%PATH%;E:\Program\xampp\mysql\bin
Don't forget to change PATH

If you use wamp server add C:\wamp64\bin\mysql\mysql5.7.31\bin to environment variables PATH

To make it easier to invoke MySQL programs in CMD, you can add the path name of the MySQL bin directory to your Windows system PATH environment variable:
follow the below link.
https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/mysql-installation-windows-path.html

In my case changing the directory to
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
I have noticed no changes but when I wrote mysql
It ran perfectly

If the error isn't solved after setting the system variables and path, check the path specified in User Variables.
If the path is not set in user variables, add it.
This worked for me.

This worked for me(Windows):
Firstly in cmd type: where{space}MySQL{enter}--->It gives something like this:
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
Add path=C:\Program Files\MySQL\MySQL Server 8.0\bin to System variable. How to set path to system variable ?
Close and restart your Command prompt. After that write from anywhere in cmd:
mysql --version
It will give results:
mysql Ver 8.0.28 for Win64 on x86_64 (MySQL Community Server - GPL)

In my case, I resolved it by adding this path C:\xampp\mysql\bin to system variables path and then restarted pash/cmd.
Note: Click me if you don't know how to set the path and system variables.

Related

windows could not start the MySQL. service on local computer. Error 2 : The system cannot find the file specified

I am not able to start the MySQL server on my Windows system. When I tried in services.msc to run, I got this error:
Starting it through the XAMPP control panel does not work either:
Can you help me to solve this?
Open windows services (Start->run ->Services.MSC)
Find service with name "Mysql Server" and check path, it should be something like that:
"C:\Program Files (x86)\Parallels\Plesk\Databases\MySQL51\bin\mysqld.exe" "--defaults-file=C:\Program Files (x86)\Parallels\Plesk\Databases\MySQL\Data\my.ini" MySQL
Make sure that Mysql folder and executable file mentioned above exist by this path.
OR
Sometimes the file name of mysqld-nt.exe renamed to mysqld-nt.exe~ so rename it back to its original name and this may solve the problem.
Go to the path: C:Programs Files\MariaDB 10.2\data..
Lookout for my.ini file. Open the file and check the path for "datadir".
If that does not match to your installed directory then update it.
Your problem will be solved for sure.
I faced the same problem and solved it.
Just modify the registry editor value.
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/MySQL/ImagePath

The MySQL57 service on Local Computer started and then stopped

When I try to start my SQL server, a message pops up saying that it starts but then stops. This happened after a restart on my server.
Does anyone know how I can fix this?
Make sure that the data directory has full permissions set for users "Network Service" and Administrator and that you have quotes around the name of the directory if there are spaces in it. Make sure that basedir is set / not commented out.
I tested these things by changing the data directory, which re-caused the error you describe above exactly, then fixed the permissions of the newly created data directory to eliminate the error. I can switch back and forth now my changing which data directory I comment out. (only as a test, otherwise that's kind of nuts).
C:\ProgramData\MySQL\MySQL Server 5.7\my.ini Should be something like this, using Windows 2012 R2 server to test:
# Path to installation directory. All paths are usually resolved relative to
this.
basedir="C:/Program Files/MySQL/MySQL Server 5.7/"
# Path to the database root
# datadir="C:/ProgramData/MySQL/MySQL Server 5.7/Data"
datadir="d:/ProgramData/Data"
Please try the following steps:
run 'cmd' as administrator,
cd to your SQL folder,
run 'mysqld --initialize --user=mysql --console' to reset and
run 'net start mysql' to start the service.
Nothing worked for me except for uninstalling the current 5.7.35 and then installing the 5.7.31. Try downgrading. Might help!
add to config file my.inf on C:\ProgramData\MySQL\MySQL Server 5.7
[mysqld]
tmpdir=C:/temp
and everything will work fine .

mysql server data folder is not visible in windows

I'm trying to locate data folder of mysql server 5.7
When I run this query
SHOW GLOBAL VARIABLES LIKE 'datadir';
I got my data dir path, but when I actually go there in c drive its not there.
Checked all hidden properties, all are fine.
Any help ?
It could be hidden. Default datadir on Windows 10 is C:\ProgramData which is normally hidden.
This link describes initializing the data directory on Windows or UNIX-like OSs.
For Windows
Because you have problems with finding the data directory I suggest you define it yourself.
First you have to make sure the following lines are in my.ini file:
[mysqld]
basedir=C:\\Program Files\\MySQL\\MySQL Server 5.7
datadir=D:\\MySQLdata # here you could put
The second line points to your MySQL Server installation. The third line to wherever you want your data directory to be. After saving the file. You could call following command:
C:\> bin/mysqld --defaults-file=C:\my.ini --initialize
With C:\my.ini pointing to your my.ini file. Hope this helps you

Full Text Search with ft_min_word_len less than 3 chars [duplicate]

I have already seen
http://dev.mysql.com/doc/refman/4.1/en/mysql-config-wizard-file-location.html
how to know mysql my.cnf location
and
http://dev.mysql.com/doc/refman/5.1/en/option-files.html
But I am still stuck with the ages old question!
"Where is my my.ini"
I am using windows server 2008 with mysql 5.5.28. I installed the service using mysqld --install and I am able to use the mysql server using sqlyog. But unfortunately I am not able to find my.ini in installation directory or not in c:\ neither in c:\windows nor in data_dir query show variables like "mysql_home" returned nothing as well.
Any suggestions?
my.ini LOCATION ON WINDOWS MYSQL 5.6 MSI (USING THE INSTALL WIZARD)
Open a Windows command shell and type: echo %PROGRAMDATA%. On Windows Vista this results in: C:\ProgramData.
According to http://dev.mysql.com/doc/refman/5.6/en/option-files.html, the first location MySQL will look under is in %PROGRAMDATA%\MySQL\MySQL Server 5.6\my.ini. In your Windows shell if you do ls "%PROGRAMDATA%\MySQL\MySQL Server 5.6\my.ini", you will see that the file is there.
Unlike most suggestions you will find in Stackoverflow and around the web, putting the file in C:\Program Files\MySQL\MySQL Server 5.6\my.ini WILL NOT WORK. Neither will C:\Program Files (x86)\MySQL\MySQL Server 5.1. The reason being quoted on the MySQL link posted above:
On Windows, MySQL programs read startup options from the following
files, in the specified order (top items are used first).
The 5.6 MSI installer does create a my.ini in the highest priority location, meaning no other file will ever be found/used, except for the one created by the installer.
The solution accepted above will not work for 5.6 MSI-based installs.
Enter "services.msc" on the Start menu search box.
Find MySQL service under Name column, for example, MySQL56.
Right click on MySQL service, and select Properties menu.
Look for "Path To Executable" under General tab, and there is your .ini file, for instance, "C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MYSQL56
I've found mine in
\ProgramData\MySQL\MySQL Server 8.0\
(It is a hidden folder)
You can type win+R and write %PROGRAMDATA% to access that folder, or just enable show hidden folder.
You have to look I the folder C:\Program Files\MySQL\MySQL Server 5.5 but there is a problem. When you perform an MSI install of MySQL, my.ini is not created. There will be sample .ini files in that folder. In order to use one of them, say my-medium.ini, you need to do the following before a MySQL restart:
cd C:\Program Files\MySQL\MySQL Server 5.5
copy my-medium.ini my.ini
net stop mysql
net start mysql
Once, you do this, my.ini can be read by C:\Program Files\MySQL\MySQL Server 5.5\bin\mysql.exe.
Start MySQL Workbench, then Server -> Options File and look at bottom of the window; it will say something like "Configuration File: C:\ProgramData\MySQL\MySQL Server 5.6\my.ini"
(And note the subtle difference between "ProgramData" and "Program Files" - easy to gloss over if you're looking for a quick answer.)
Answered for only MySQL Workbench users,
You can find the my.ini file in windows at this location-
C:\ProgramData\MySQL\MySQL Server 5.6
the ProgramData folder is a hidden folder, so make the according setting to see that folder.
And open my.ini file as an administrator to edit and then save that.
In my case, the folder ProgramData was hidden by default on windows 7, so I was unable to find my.ini file.
After selecting show hidden files and folders option, I was able to find the my.ini file at the location: C:\ProgramData\MySQL\MySQL Server 5.6.
Display hidden files and folders on windows 7:
Right-click the Windows Logo button and choose Open Windows Explorer.
Click Organize and choose Folder and Search Options.
Click the View tab, select Show hidden files and folders and then clear the checkbox for Hide protected system operating files.
Click Yes on the warning and then click OK.
Press the windows key > type services > press enter > Look up mysql in the list > right click > properties > Path to Executable will have the location of the defaults file right below it (my.ini)
it is there at C:\Program Files\MySQL\MySQL Server 5.5 there are various .ini files with small, medium & large names. generally medium is used or it depends on your requirement.
programData is hidden folder so you have to change the option from setting to show hidden folder and then make the change in my.ini file present in that.
Be sure to update the correct my.ini file because it can waste a lot of your time if you keep updating wrong file.
You can look into service to see which my.ini is configured in this service.
Open your run console
type: services.msc
look for: mysql
right click
properties
where is written "path to executable", click and move the cursor to the right until you see the directory of my.ini, it's written "defaults-file-".
to reach it manually on your explore folders you have to enable the visualization of hidden elements (explore folder>top menu>visualize>visualize hidden elements)
as explained by this video
https://www.youtube.com/watch?v=SvCAa2XuQhg
on Windows if MySQL is install as a service you can change the binpath of the service. For example
sc config MySQL57 binPath= "\"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe\" --defaults-file=\"<myini path>" MySQL57"
space after binpath is important. You must escape double quotes
MySQL and MariaDB
According to the documentation of both MySQL and MariaDB you need to run mysql with --help --verbose to know the location of the my.ini file
Go to the command or terminal
cd yourMySQLBinDirectory
mysqld --verbose --help
You will see large output but first few lines will show the order the server is looking for the file. I got the following response. It will be different for your computer or server.
Default options are read from the following files in the given order:
C:\WINDOWS\my.ini C:\WINDOWS\my.cnf C:\my.ini C:\my.cnf D:\Databases\mariadb-10.3.30-winx64\my.ini D:\Databases\mariadb-10.3.30-winx64\my.cnf D:\Databases\mariadb-10.3.30-winx64\data\my.ini D:\Databases\mariadb-10.3.30-winx64\data\my.cnf
I met with the same problem when I did MSI install of MySQL and there were no my-medium.ini files too when I tried the above steps. Only installing the ZIP file of MySQL helped me. So, I suggest you to uninstall the MSI installed folder and reinstall using the ZIP file.
For MySql Server 8.0 The default location is %WINDIR% or C:\Windows.
You need to add a "my.ini" file there.
Here's a sample of what I put in the ini file.
[mysqld]
secure_file_priv=""
Make sure to restart the MySQL service after that.

Where can I find the file my.ini file for windows mysql server?

The same question is repeated again and again and i am another one repeating this question .
I have already set up my mysql server .
Its location is C:\Program Files\MySQL\MySQL Server 5.5
but i am not able to find the my.ini file inside the above path .
When i type the command c:>mysql --help
The output looks like
Default options are read from the following files in the given order:
C:\Windows\my.ini C:\Windows\my.cnf C:\my.ini C:\my.cnf C:\Program Files\MySQL\M
ySQL Server 5.5\my.ini C:\Program Files\MySQL\MySQL Server 5.5\my.cnf
The following groups are read: mysql client
But when I opened the above locations from where it is reading these files ,I am unable to locate the file . Can anyone tell me what is the exact way to retireve the my.ini file for WINDOWS?
In MySQL 5.5 Windows the default path for my.ini is
C:\ProgramData\MySQL\MySQL Server 5.5
You may need to change your file browser (windows explorer) options to show hidden files and directories.
To configure the client and utility applications, create a new my.ini file in the Windows installation directory. More info here
I just checked my installation and located my.ini at C:\Program Files\MySQL\MySQL Server 5.5 which seems to be exactly the same like your installation path (and mysql version is the same for us). Are you sure it isn't there?
EDIT:
Possibly all you have to do is to rename one of example .ini files to my.ini (and optionally tune it to your needs), see: http://dev.mysql.com/doc/refman/5.1/en/option-files.html#option-files-preconfigured . These are: my-small.cnf, my-medium.cnf, my-large.cnf, and my-huge.cnf in your mysql installation dir. It is possible that this is just what I did in my case - it was a while ago when I installed mysql.
Under the Data folder my friend. Go one dir up from Mysql 5.5
Check variable datadir, in my default setup of 5.7 on Windows 7 it used:
C:\ProgramData\MySQL\MySQL Server 5.7
Just visit: http://opensourcedba.wordpress.com/2011/01/12/mysql-basics-part-3-%E2%80%93-your-my-cnf-or-my-ini-file/?blogsub=confirming
This has the whole content required for my.ini.
If you do not see my.ini file. Rename one of below file to my.ini
my-huge.ini
my-large.ini
my-medium.ini
my-small.ini
You can check the my.ini through the below process:
1. Through the command prompt. Type command as "Services.msc".
2. Go to MySQL56 service and right Click. Select Properties.
3. In the Properties area you will get the my.ini file path at the end.
I found the my.ini file by running SHOW VARIABLES LIKE "%datadir%"; and going one directory up.