MariaDB 安装:我在安装过程中未选中作为服务运行.启动和停止 mariadb 的正确方法是什么?

2022-01-15 00:00:00 windows mariadb mysql windows-services

现在,我不知道如何启动 mariadb,因为我没有将它安装为运行服务.

Now, I don't know how to start mariadb since I didn't install it as a running service.

这对我没有帮助: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 FilesMariaDB 10.0in>mysql_install_db.exe --datadir=c:mariadb --service=MyDB --password=secret运行引导程序删除默认用户设置root密码创建 my.ini 文件注册服务MyDB"致命错误:OpenSCManager 失败 (5)

C:Program FilesMariaDB 10.0in>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 包含一些帮助用于解决最常见的问题.如果这对您没有帮助,请在知识库中留下评论或提交错误报告http://mariadb.org/jira

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

然后我去发出这个命令:C:Program FilesMariaDB 10.0in>mysqld.exe --datadir=../data

I then went and issued this command: C:Program FilesMariaDB 10.0in>mysqld.exe --datadir=../data

但它只是停留在那里闪烁.是的,我可以使用 Heidisql 连接到 maria db,但是上面的命令提示符是否假设在上面的命令下闪烁一行?

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?

现在,我不知道如何关闭数据库.我去了文档,找不到这个命令:mysql.server stop

Now, I don't know how to shutdown the database. I went to the documentation and can't find this command: mysql.server stop

但是 Windows 7 没有这样的命令/脚本.

But there's no such command / script for windows 7.

我试过了:

C:Program FilesMariaDB 10.0in>mysqladmin -u root -p shutdown输入密码: ********mysqladmin:连接到localhost"的服务器失败错误:'无法连接到'localhost'上的MySQL服务器(10061未知错误")'检查 mysqld 是否在 localhost 上运行并且端口是 3306.您可以通过执行 'telnet localhost 3306' 来检查这一点

C:Program FilesMariaDB 10.0in>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'

我使用的是 Windows 7.

I'm using windows 7.

我读过http://dev.mysql.com/doc/mysql-startstop-excerpt/5.0/en/windows-server-first-start.html

启动我在 bin 目录 mysqld --console 中运行的服务器

that to start the server I run inside the bin directory mysqld --console

我运行了这个命令来停止 mariadb,但它似乎不起作用:

I ran this command to stop mariadb, but it didn't seem to work:

C:Program FilesMariaDB 10.0in>mysqladmin 关闭 -p输入密码: ********mysqladmin:连接到localhost"的服务器失败错误:'拒绝访问用户'ODBC'@'localhost'(使用密码:YES)'

C:Program FilesMariaDB 10.0in>mysqladmin shutdown -p Enter password: ******** mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'ODBC'@'localhost' (using password: YES)'

我仍然可以连接.

我在 Windows 7 上启动和停止 maria db(最新版本 3/15/2015)的正确方法是什么?

What's the correct way for me to start and stop maria db (latest version 3/15/2015) on windows 7?

更新:我可以用它来关闭:mysqladmin -u root -p 关闭

Update: I'm able to use this to shutdown: mysqladmin -u root -p shutdown

是否有正确的方法来启动和关闭 mariadb?我真的不希望 mariadb 在我打开机器时自动运行.

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.

谢谢.

推荐答案

这就是你要做的.

  1. 在 Microsoft 管理控制台中打开服务应用.
    • 点击开始按钮
    • 输入服务
    • 按回车键.
  • 向下滚动以查找 MySQL 服务
  • 双击它
  • 如果可以,请按停止按钮.
  • 点击开始按钮并输入 cmdpowershell
  • 右键单击开始菜单中显示的程序.
  • 单击以管理员身份运行"项.
  1. 输入 mysqld --remove
  2. 输入 mysqld --install
  3. 输入 mysqld --start

该操作序列应删除该服务,然后再安装它.最后它会启动它.如果您不在管理员模式下使用 shell,这将不起作用.

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.

您可以通过关闭、重新打开并查看 Microsoft 管理控制台中的服务"应用来仔细检查这是否正确.

You can double check this is right by closing, reopening, and looking at the Services app in the Microsoft Management Console.

为什么会这样?因为,与许多服务 .exe 程序一样,MySQL 和 MariaDB 服务器是自行安装的:它们包含将自身作为服务安装和删除所需的代码.

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.

相关文章