To use MySQL tools on the Windows command line, you need a convenient way to access them without having to type the full path to MySQL executables. The simplest way is to add the bin folder of the MySQL installation to the system path. That's done in the Advanced tab of the Windows System Properties dialog. Click on Environment variables, in the System variables area of what pops up, select Path , click Edit , add ...
c:program files\mysql\mysql VERSION\binwhere VERSION is the major version number, e.g.,5.7 or 8.0, or whatever your installation folder is if you picked a custom location, with the suffix bin , and click OK. On Windows versions before 8, you may need to reboot before the Windows command line tool can find the updated path. Now when you open a command line window as administrator, and type ...
mysqld --help | moreyou should see MySQL server help, one screen at a time. Now you have access to the MySQL server, client programs and utilities. One other convenience note: the command line is more useful if set to 50 lines high, and as wide as your screen allows. To start the service for the first time, issue ... mysqld --defaults-file="c:program files\mysql\mysql VERSION\my.ini" --console –-skip-grant-tablesagain substituting VERSION as abive. If there are errors, you will see them in this window; fix them and try again. Once the server starts normally, the window will freeze. Open another command line window to run the mysql client ...
mysql -uroot -pPWDsubstituting your MySQL password for PWD .
Once you've established that the server is running, in the second command line window issue ...
mysqladmin shutdownTo use the command line window to start the MySQL service that's been created by the MySQL installer, isue ... net start mysqldor whatever service name has been set by your installation. Windows also has a powerful command line service control utility, sc.exe for starting, stopping and configuring Windows services. To see its help screen, run ... sc /? | moreFull help for this utility is at https://technet.microsoft.com/en-us/library/bb490995.aspx?f=255&MSPPError;=-2147217396. The MySQL manual has a page about the MySQL service on Windows, https://dev.mysql.com/doc/refman/8.0/en/windows-start-service.html. Last updated 8 Dec 2024 |
![]() |