MySQL: Cannot start Service, Windows 10 - mysql

I am aware that this question has been asked many times before, but all solutions I tried out did not work for me.
So, I installed MySQL Workbench and server. I log into Workbench as root. In the toolbar I click on Server then Startup/Shutdown and there I click on the button Start Server. But whenever I do this, I get following log:
018-05-14 21:09:59 - Starting server...
2018-05-14 21:10:07 - Server start done.
2018-05-14 21:10:09 - Checking server status...
2018-05-14 21:10:09 - Trying to connect to MySQL...
2018-05-14 21:10:09 - Can't connect to MySQL server on 'localhost' (10061) (2003)
2018-05-14 21:10:09 - Assuming server is not running
Addiotionally a popup appears which says:
Connect Error
Could not connect to MySQL: Can't connect to MySQL server on 'localhost' (10061)(code 2003)
One solution I found suggested installing the server manually. So I went into cmd as admin and typed:
C:\> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld" --install
It gave following output:
Service successfully installed.
But in Workbench the Server is still stopped and when trying to start it like mentioned above the same logs with the same popup and error appears.
Another solution I found suggested installing MySQL Notifier and using it to start and stop the server and use it to manage monitored items. But quite frankly, once I restart workbench and try to log in as root, it wont even log in but give following pop up error:
Cannot Connect to Database Server
Your conection attempt failed for user 'root' from your host to server at localhost:3306:
Authentication plugin 'catching sha2 password' cannot be loaded: Das angegebene Modul wurde nicht gefunden.
Please:
1 Check that mysql is running on server localhost
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the root has rights to connect to localhost from your adress (mysql rights define what clients can connect to the server from which machines)
4 Make sure you are both providing a password if needed and using the correct password for localhost connecting from the host adress you're connecting from
So now this "Authentication plugin 'catching sha2 password' cannot be loaded:" looks suspicious and I tried looking that up. I found this solution, which requires me to log into MySQL from cmd, but when I type C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p and execute it, it asks for the password which I provide, but then it answers with
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
Now I hit a wall and I don't know how to continue. The MySQL server still doesn't work and I am desperate.

Do you have SQL Server (MSSQL) instance installed on your machine? If so, this may cause an issue. MSSQL may "capture" port 3306. Try to stop MSSQL service and test MySQL.

The easiest way to resolve the error where the service does not start is by going into the registry as Administrator.
Navigate to HKLM\System\ControlSet001\Services\MySQL
Change image path to "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe" --defaults-file=C:\Program Files\MyNewSQL\bin\MyNewSQL.ini MyNewSQL
My problem (same as yours):
Current Registry Setting:
C:\MySQLs\MySQLDev\bin\mysqld --defaults-file=C:/MySQLs/MySQLDev/MySQLDev.ini MySQLDev
Change Registry Setting to:
C:\MySQLs\MySQLDev\bin\mysqld.exe --defaults-file=C:/MySQLs/MySQLDev/MySQLDev.ini MySQLDev
Rerun "net start MySQLDev"
The MySQLDev service is starting.
The MySQLDev service was started successfully.

On Windows 10 and previous versions, you MUST give the User assigned to the MySQL service full permission of the MySQL folders.
I believe the newest version uses, User NETWORK SERVICES, therefore use File Explorer, right click on all of the MySQL folders, click on Properties, Security, Edit and give User NETWORK SERVICES full access of those folders.
Failure to do this will result in the Service starting and stopping due to errors which are visible if you use Command Line.

Related

New MySQL Workbench Install (Will not connect to root) Ubuntu 18.04

My newly installed MySQL workbench is refusing to connect to the root of my newly installed MySQL Community Server. Whenever I attempt to access "Local Instance 3306" (the default MySQL connection) I get the following error message.
This error message does change if I open "Local Instance 3306" via the "edit connection" tab and then "test connection". I'll get a different but similar error code.
I can access the server via the command line
and can confirm that the server appears to be active also via command line.
It is a fresh install of MySQLCommunity Server and MySQL Workbench running on Ubuntu 18.04 with only one user account. I installed both the server and workbench using apt and used the guide created by DevAnswers.co here.
After installing the server and workbench I attempted to access the server using the workbench BEFORE I ran the sudo mysql_secure_installation command. I got the same two errors. I then ran the secure installation command and assigned a password which I do remember and did input into the password field of mySQL workbench albeit with the same results. I am very new to mySQL and databases and am trying to install mySQL to learn how to use SQL. I'd appreciate any help you all can provide in resolving this issue.
Additional pictures:
and .
I suspect that you just need to follow this short guide to set a root password:
https://whs-dot-hk.github.io/ubuntu-18.04/install-mysql.html
After setting a root password, you should be able to connect to mysql-workbench.
In short the root user in MySQL is authenticated using an auth socket, not a password. That's what's giving the message you're getting in the first screenshot.
(I'm assuming this is for a development project, for a production project you should keep the default config)

MariaDB install: I unchecked running as service during installation. What is correct way to start and stop mariadb?

Now, I don't know how to start mariadb since I didn't install it as a running service.
This didn't help me:
https://mariadb.com/kb/en/mariadb/starting-and-stopping-mariadb/
I googled and thought this would work to set it as a service:
C:\Program Files\MariaDB 10.0\bin>mysql_install_db.exe --datadir=c:\mariadb --service=MyDB --password=secret
Running bootstrap
Removing default user
Setting root password
Creating my.ini file
Registering service 'MyDB'
FATAL ERROR: OpenSCManager failed (5)
http://kb.askmonty.org/v/installation-issues-on-windows contains some help
for solving the most common problems. If this doesn't help you, please
leave a comment in the Knowledgebase or file a bug report at
http://mariadb.org/jira
I then went and issued this command:
C:\Program Files\MariaDB 10.0\bin>mysqld.exe --datadir=../data
But it just stays there blinking. Yes, I can connect to maria db with Heidisql, but does the above command prompt suppose to blink one line under the above command?
Now, I don't know how to shutdown the database. I went to the documentation and can't find this command: mysql.server stop
But there's no such command / script for windows 7.
I tried:
C:\Program Files\MariaDB 10.0\bin>mysqladmin -u root -p shutdown
Enter password: ********
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to MySQL server on 'localhost' (10061 "Unknown error")'
Check that mysqld is running on localhost and that the port is 3306.
You can check this by doing 'telnet localhost 3306'
I'm using windows 7.
I've read
http://dev.mysql.com/doc/mysql-startstop-excerpt/5.0/en/windows-server-first-start.html
that to start the server I run inside the bin directory mysqld --console
I ran this command to stop mariadb, but it didn't seem to work:
C:\Program Files\MariaDB 10.0\bin>mysqladmin shutdown -p
Enter password: ********
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'ODBC'#'localhost' (using password: YES)'
I'm able to connect still.
What's the correct way for me to start and stop maria db (latest version 3/15/2015) on windows 7?
Update:
I'm able to use this to shutdown:
mysqladmin -u root -p shutdown
Is there a correct way to start and shutdown mariadb? I really don't want mariadb to be running automatically whenever I turn on my machine.
Thanks.
Here's what you do.
Open the Services app in the Microsoft Management Console.
hit the start button
type services
hit the enter key.
Make sure the MySQL service is stopped if it is in fact installed. (MariaDB ordinarily is installed as if it were the MySQL service).
scroll down to find the MySQL service
double click it
If you can, push the Stop button.
Start a Windows shell (cmd or powershell) as an administrator.
hit the start button and type cmd or powershell
right click on the program that shows up in the start menu.
click the Run As Administrator item.
Set your working directory: cd C:\Program Files\MariaDB 10.0\bin
In the next commands, some may fail. Just keep going.
Type mysqld --remove
Type mysqld --install
Type mysqld --start
That sequence of operations should remove the service and then install it. Finally it will start it. If you don't use a shell in Administrator mode, this won't work.
You can double check this is right by closing, reopening, and looking at the Services app in the Microsoft Management Console.
Why does this work? Because, like many service .exe programs, MySQL and MariaDB servers are self-installing: they contain the necessary code to install and remove themselves as services.
Just so to have it documented. This is not specific to MariaDB at all, just to MSI in general.
If you forgot to install MSI feature (which, for MariaDB is 'Database Instance') you start the MSI again, click on "Next" in the Welcome page, in the "Change/Repair/Remove" dialog choose "Change", select 'Database Instance' in the feature selection list, "Next" et voila, it will be installed.
If you forgot to check the service checkbox, the easiest is uninstall and install again, it goes really fast.
As for mysql_install_db.exe, it must be run in an elevated console, and you would not have experienced any problems if it had(this is also documented)
Please, avoid "mysqld --install", it is very limited. Only if you want to compromise your computer running mysqld under the most powerful Windows account, then use it.
Instead, mysql_install_db.exe if you need many instances on the machine, or the MSI otherwise.

Cannot Connect to Database Server mysql workbench

I'm trying to connect to mysql workbench but I get the following error
Error Message
Cannot Connect to Database Server
Your connection attempt failed for user 'root' from your host to server at
127.0.0.1:3306:
Could not open database.
Please:
1. Check that mysql is running on server 127.0.0.1
Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
Make sure you are both providing a password if needed and using the correct
password for 127.0.0.1 connecting from the host address you're connecting
When I Test Connection, the parameters are correct, and actually I can enter and manage database in console.
When I installed Mysql for first time I could enter to Workbench one time and if I closed Workbench I had to restart my PC to connect another time.
I reinstalled 2 or 3 times Mysql server and Workbench and now I cannot connect from Workbench even once.
I faced similar issue and resolved it by following these steps:
In the terminal, execute this command
mysql -u root -p -h localhost -P 3306
Enter the password
This will be displayed
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 8.0.16 Homebrew
Now do,
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
Now you should be able to login and connect to DB in the workbench with password 'root'
I don't know if it helps anyone, but I had the same problem on windows after updating from MySQL 5.7 to 8.0.
The solution for me was to go to services.msc, stop the MySQL service and start the "MySQL80" service instead.
Then I restarted MySQL Workbench (run as admin) and it worked.
Please make sure that You have Downloaded MySQl server while dowloading MySQl workbench from MySQl installer (if you have checked Custom download)
I had the same issue a few days ago. As I could see in the original question, there has been multiple MySQL installation on the same computer - the same flow I tried after failing in the first attempt.
In the case we are trying to reinstall MySQL, we should be aware of remaining hidden files after MySQL has been uninstalled for the first time. In order to remove them all (and make one successful installation), we should:
Make hidden files visible on your computer (instructions)
Delete all files related to MySQL after choosing uninstalling of the MySQL (I had to check C://ProgramData hidden folder)
Try a new installation
I think that during the first installation, I didn't have all required dependencies on the computer (for example Python) and the installation failed. After installing it, uninstalling the MySQL, and taking steps from above, I finally managed to run it successfully :)
I hope this could help someone! :)
This solved it for me (MAC OS)
Open MySQL from System Preferences > MySQL
Click 'Stop MySQL Server' if the server is running
Select 'Initialize Database'
Type your new password.
Choose 'Use legacy password'
Start the Server again.
Now connect the MySQL Workbench

How to Activate MySQL Database on XAMPP for Windows

I can't access phpMyAdmin on XAMPP for Windows and the problem must be with MySQL, because on the XAMPP Status, it says MySQL database is DEACTIVATED. But on my XAMPP Control Panel Application, I've already started MySQL and it says Running, although I didn't check the Svc tick box (Is that necessary?). How to activate MySQL database so that I can run phpMyAdmin?
Also, when I open phpMyAdmin page, it says :
*Error
MySQL said: Documentation
2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
Connection for controluser as defined in your configuration failed.*
I've already done a research for an answer to this question, but none of them works for me.
XAMPP only summarys MySQL (Database Server) & Apache (Webserver) in one setup and u can manage them with the xampp starter.
Aftet the successfully installation navigate to your xampp folder and execute the xampp-control.exe
Press the start Button at the mysql line.
Now u started successfully mysql. Now there are 2 different ways to administrate your mysql server and his databases.
But at first u have to set/change the MySQL Root password. Start the Apache server and open at your browser localhost or 127.0.0.1. If you didn't deleted anything from the htdocs folder the xampp status page appears. Navigate to security settings and change your mysql root password.
Now after this, you can browse to your phpmyadmin under localhost or download a windows mysql client for example navicat lite or mysql workbench. Install it and log to your mysql server with your new root password.

Access Denied for user root#localhost on mysql

My environment is MySql 5.6 on Windows 7 64 bit
I cannot log in as root to the MySql server running on my machine, from the same machine using either the workbench or the mysql command prompt
I followed the steps to change the password here: http://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html
if you do that, it leaves an instance of MySQL running in a console window. While that is running, I can connect just fine.
When I Ctrl+C out of that and close the console window, and start MySqlD up as a service, I get access denied again. Despite the password working a minute earlier.
I only have one installation of MySql on the machine, in C:\Program Files\MySQL\MySQL Server 5.6\bin
The MySql Windows Service is set to log on as "Network Service" account.
Also, I am using the Password() function to encrypt the password as stated in the steps above
In case anybody else finds this I eventually gave up and reinstalled mysql and made a note of the root password this time. What a palaver!