Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 808
Derick Avatar asked Mar 16 '15 00:03

Derick


2 Answers

Here's what you do.

  1. Open the Services app in the Microsoft Management Console.
    • hit the start button
    • type services
    • hit the enter key.
  2. 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.
  3. 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.
  4. Set your working directory: cd C:\Program Files\MariaDB 10.0\bin
  5. In the next commands, some may fail. Just keep going.
    1. Type mysqld --remove
    2. Type mysqld --install
    3. 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.

like image 127
O. Jones Avatar answered Sep 30 '22 14:09

O. Jones


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.

like image 41
Vladislav Vaintroub Avatar answered Sep 30 '22 14:09

Vladislav Vaintroub