MySQL Server disappeared and it cannot be installed again - mysql

I wanted to reinstall MySQL Workbench 8.0, because I lost my password.
First, I stopped the server in services.msc, as it was written in the official guide for the password recovery.
Unfortunately, it just disappeared from the services list forever.
I tried to install it again using the mysqld --initialize and mysqld --install commands, but I get an "Access denied" message.
I can't start the server, I can't get my password back.
I would appreciate any help.
Thank you in advance,
Karolina

Related

How to start mysql service without systemctl/service tool

Mysql service is running on centos system. Recently we had a planned power outage so we shut down the mysql services.
I am bringing back the service now. I wish to run mysqld_safe as mysql user and not to start as root and not to use systemctl/service.
The only method I know is:
sudo systemctl mysql restart
sudo service mysql start
Anyone have any inputs on how I can start mysql service as mysql user without using systemctl/service tool.
I tried this in /usr/bin
mysqld_safe -user=mysql & and got permission denied error
Thanks for you inputs in advance.

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.

Locked out of MySQL server - CentOS

I have a server running CentOS and I installed myphp, phpmyadmin, mysql, mysql-server and it asks me for a password when trying to run the mysql safe install. I have not set a password and it says if you have not set one, then press enter, but this doesn't not work. Also I can't stop mysql and reinstall because that gives me the error:
mysql access denied for user 'root'#'localhost'
I've looked about a few places online and I cant find any fixes.
If it's possible, shut down the mysql daemon (service mysql stop). You can start it in safe mode to skip authorization with mysqld --skip-grant-tables. Then you can connect to it as root without password and reset the password.
Ok so what I did was service mysql stop and then mysqld_safe --skip-grant-tables & whilst I was in the root directory. What I did not realise was that when I do this, I am now in the SQL command line. This was my first time using mysql and so when the [root#blahblah] wasn't showing in the left side, I thought that the process has crashed but that was not true. Once I realised that I was actually in the SQL command line I was able to change my password.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when I typed "mysql"

I just installed mySQL and when I try to type mysql in my mac terminal I'm getting
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I tried searching for an answer but I'm still stuck. Also, I don't know if this is relevant or connected, but when I go to my preference panel to try to start mySQL it doesn't start. On some sites such as other stackoverflow pages, it says to try running "/usr/local/mysql/bin/mysqld_safe" but for me it just permission denied..
I tried to do ps -u mysql to check if it's running and it printed out and an address: usr/local/mysql/bin/mysqld --basedir=/usr/local. So I assume it's running? Even though I can't physically press the button and enable it in the preference panel which is weird.
EDIT: I typed
$ sudo /usr/local/mysql/bin/mysqld_safe
Password:
130930 11:55:15 mysqld_safe Logging to '/usr/local/mysql/data/myname-mac.att.net.err'.
130930 11:55:15 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
130930 11:55:18 mysqld_safe mysqld from pid file /usr/local/mysql/data/myname-mac.att.net.pid ended
why did it end right there?
I had this same error message for days and finally figured it out.
I had somehow gotten a my.cnf file on my computer from AMPS or possibly another MYSQL install (that I believed I had deleted).
But it turns out it was a hidden file in /etc/ that I had to manually delete. http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/
Finally, I installed MySQL with homebrew one more time –– and success! It works. Also of course this time I spot a message in the homebrew setup process that points out the problem I was having:
A "/etc/my.cnf" from another install may interfere with a
Homebrew-built server starting up correctly.
Hope this helps.
I also experienced a similar error. After trying all prescribed solutions like in this related post, noticed that it was a simple solution: first make sure the mysql daemon is running. For example, on a Homebrew installation (macOS), start mysql with: brew services start mysql

MySQL issue: Table 'data_dictionary.CHARACTER_SETS' doesn't exist

Recently I have updated from MySQL 5.1 to 5.5 and after few weeks the following error message was displayed each time I access the phpMyAdmin application:
1146 - Table 'data_dictionary.CHARACTER_SETS' doesn't exist
I have investigated the issue to the point where I have been forced to downgrade the MySQL service to 5.0.95 and then to upgrade the service once again to 5.1.
None of the above outlines steps however resolved the issue and the error message in questions still persist . This error disables me to access any database/table via the phpMyAdmin interface.
The error logs on the server are not providing additional information at all. The checked logs were:
-> mysql.err log
-> the cpanel error log
Any help will be highly appreciated
Run sudo mysql_upgrade -u root -p --force
Then restart mysql
i.e. sudo service mysql restart or sudo service mysqld restart depending on the version and distribution you have
You need to logout of phpMyAdmin then login for the change to take effect.
I was facing the same problem. It can be resolved by reconfiguring phpMyAdmin.
sudo dpkg-reconfigure phpmyadmin
Close phpMyAdmin page and