Restart mysql after ending process - mysql

I ran an sql via the mysql command prompt, but it was taking too long so I decided to stop it. I closed the window, but I could see in Task Manager that mysqld.exe was still using 50% of my CPU. I therefore ended that process via the task manager. But now I don't know how to reconnect to MySQL. If I try to start a mysql command prompt again, I'm told that it can't connnect. I also tried "net start MySQL" but it says that the service name is invalid. Last time, I ended up restarting my computer.

I see two options: If you are using MySQL as a service then you must have killed the service. You should go to Start Menu -> Run... and then execute services.msc. Look for MySQL service there and start it.
If you are not using MySQL as a service then you'll have to look for the executable and execute it again.
Note: If you got it working after a restart then I bet you're running it is as a service set to start automatically.

Related

How to kill all the MySQL process in window

I'm using win10 and I have MySQL workbench 8.0 CE. I am trying to run my SQL script to check if there's any error but after I created the SQL forward engineering script and close anything about MySQL and reopen it and tried to run the script file it shows
[WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\Ozcar\AppData\Local\Temp\tmps2jek87r.cnf'
I tried to end anything about mySQL in task manager and I use cmd to do net stop MySQL8.0 and net start MySQL8.0 also but is still not work
How am I kill all the SQL processes and restart them properly?
Thank you for everyone who answer me.

Why is mysql running when i am not using it?

I have used mySQL for a project in the past, and haven't used it for months. However, when i check my task manager 'mysql' is using about 100MB of RAM. This happens every times i reboot. Why is my sql running, or using memory when i don't need it. Is a server running in the background that i have to disable? For context i was using my SQL Workbench 8.0 when working on my project.
Open a command prompt window cmd.exe
Stop MySQL service: net stop mysql57 (or net stop mysql)
Go to your mysql server installation path, in my case: cd "C:\Program Files\MySQL\MySQL Server 5.7\bin\"
Execute mysqld.exe --remove
This will remove the MySQL Service.
Note that You may need an elevated command line prompt, for that press WIN-X select Command Prompt (Admin)
Yes, MySQL Server service would be constantly running in the background, if (because) this service's startup type was set on an "automatic start when computer starts" mode during the installation of MySQL Workbench. The comment by #Alejandro offers the finest explanation.
(below steps I had tried for MySQL 8.0.30 version, however shall work with nearby versions as well; as steps to stop the service might be generic.)
In Windows 10, to stop the MySQL Server's service, OR, change the startup-type setting of MySQL Server.
Open Windows Services panel via the Start menu, OR, Win+R -> type services.msc, do Enter.
Different Windows OS's services would be listed here, alphabetically.
Find the MySQL Service. For MySQL 8 versions, it's often by default name - MySQL80, unless you had named it by a custom name during installation.
Click STOP, to stop the service.
On the other hand, you may choose your desired Startup type. By default, you'll find it on Automatic type.
If you want to keep Manual type, make sure to start the service by coming at this Services wizard, before using MySQL Workbench. Otherwise, the workbench won't be able to recognize/find the server.
While installing the MYSQL Server, this check box is by default checked (shown in the picture). If you uncheck this, then you need to start your MYSQL Server manually.

mysql connection automatically closes on console closed

i am running mysql server 5.5 i haven't installed it as a service.
I am starting mysql from command line by typing mysqld.
Mysql is successfully started i can query anything now, But if i close this commandline window the mysql connection is also closed.
Why is this so ?
I want it run mysql even after the console is closed without installing it as a service. Is it possible to do so or i have to keep that console window open to do all the task.
How can i solve this problem.
Please help.
If you are running a linux distro (e.g. ubuntu), then start it in a different shell (e.g. CTRL-ALT-F2) and move back to the shell you were already using.
If you are running from Windows, then why not start the GUI version of MYSQL server instead ?
In newer version of windows the (emulated) cmd is sandboxed which means that everything is discarded after closing the window, unless of course it is a service which will be hand by Windows.

Error 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

Please don't post this question as duplicate. I am trying to configure mysql for about 3 weeks now. Someone should really help me.
I recently installed MySQL 5.1 in a Lenovo laptop to do my project. The laptop is running on Windows 8.
The installation was fine but when I tried to configure MySQL it worked till the last page.
There am getting Error Nr 2003.
I tried it through the command prompt, through services in the control panel. But the problem is that the mysql service is not starting at all. Why it is not starting ? What will be blocking it from starting ?
First you need to start mysql service it is the problem for this above
error.
In case you cant start mysql service means you need to install mysql service.
Steps for install mysql service
Step 1: open command prompt and go to the mysql installed location (for example c:\Program Fiels\MYSQL\Mysql Server5.0\bin\)
Step 2: mysql --install
Step 3: start mysql service using the command NET START MYSQL command
then connect mysql using username and password.
Assuming the service is already running and you still get this error connecting to the localhost using the mysql client, then make sure you have an entry for "localhost" in your hosts file. This was the case I experienced.
I resolved this situation following the following process. After adding the MySQL path to the environment, I kept invoking the program and then checking Event Viewer in the Application Log for MySQL errors that referenced old commands in the ini file. After removing them, what was hanging me up was that the installer was looking for errmsg.sys in a folder that didn't exist, \bin\share. Those folders DO exist, but on the same level, not nested. So I added the folder share to bin and copied errmsg.sys from share to the new nested share, and it worked.
Now that its running, I intend to redo a proper configuration using the workbench, just to gets my ducks in a row.
hth
Go to Run type services.msc. Check whether MySQL services is running or not. If not, start it manually. Once it started, type mysqlshow to test the service.

XAMPP MySQL Terminating worker thread 1

I used to work with XAMPP to build PHP applications. Once I tried Zend engine and uninstalled it. After that, MySQL in XAMPP is not working. It is giving "Terminating worker thread 1" error.
When I check ports,
MySQL has status Service: MySQL_ZendServer51.
Pleas help me how to reassign it back to XAMPP? I have reinstalled XAMPP several times. But no use.
Thanks,
Raj
First you should delete the old mysql service.
Assuming you have Vista or Windows 7:
Go to Start and type cmd.exe in the search field and hit Ctrl+Alt+Enter. This will start the command line as Administrator.
Now you can type sc.exe delete MySQL_ZendServer51 to remove the service.
Now you can start your XAMPP Control Panel and uncheck the "svc" checkbox next to MySQL (if it's not already)
Next check it on again (this will install the proper mysql service)
And make sure you don't have to server running (which could be possible, that Zend installed it's own mysql but for some reason didn't removed it?)
I just went here: c:\xampp\mysql\bin\mysqld.exe
And opened the document and MySQL Started without problem.