Derick Derick - 1 month ago 10
MySQL Question

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.

Answer

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.