[英]How do I restart mysql and where is my.cnf file
I am using a Mac OS X Snow Leopard Apple computer. 我使用的是Mac OS X Snow Leopard Apple电脑。
I installed MySQL on my machine using instructions mentioned here . 我使用此处提到的说明在我的机器上安装了MySQL。 Everything works great.
一切都很好。 However I have two questions.
但是我有两个问题。
Where is my.cnf
file? my.cnf
文件在哪里? I searched the whole file system and result is empty. 我搜索了整个文件系统,结果为空。 Is it possible that there is no
my.cnf
and MySQL works with default values. 是否有可能没有
my.cnf
和MySQL使用默认值。 If yes then probably I should create my.cnf
at /etc/mysql
. 如果是,那么我可能应该在
/etc/mysql
创建my.cnf
。 Is that right? 那正确吗?
How do I restart the MySQL server ? 如何重启MySQL服务器? I know it gets started when I restart my machine.
我知道当我重新启动机器时它就开始了。 Here is what plist looks like.
这是plist的样子。
mysqld_safe
does not let me restart server. mysqld_safe
不允许我重启服务器。
KeepAlive Label com.mysql.mysqld Program /usr/local/mysql/bin/mysqld_safe RunAtLoad UserName mysql WorkingDirectory /usr/local/mysql KeepAlive Label com.mysql.mysqld Program / usr / local / mysql / bin / mysqld_safe RunAtLoad UserName mysql WorkingDirectory / usr / local / mysql
From the example my.cnf that comes with mysql: 从mysql附带的示例my.cnf:
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/mysql/data) or
# ~/.my.cnf to set user-specific options.
On my OS X 10.4 instance, my.cnf is at /etc/my.cnf. 在我的OS X 10.4实例上,my.cnf位于/etc/my.cnf。
To restart mysql, use mysqladmin to shut it down and then start it up again with mysqld_safe: 要重新启动mysql,请使用mysqladmin将其关闭,然后使用mysqld_safe再次启动它:
/usr/local/mysql/bin/mysqladmin -uroot -p shutdown
sudo /usr/local/mysql/bin/mysqld_safe &
You haven't told us what OS you're on, but the defaults on Debian Linux are: 您还没有告诉我们您使用的操作系统,但Debian Linux上的默认设置是:
/etc/init.d/mysql restart
for restart, and the my.cnf
file is located at /etc/mysql/my.cnf
重启和
my.cnf
文件位于/etc/mysql/my.cnf
It possible it doesn't exist. 它可能不存在。 You can create one in
/etc/my.cnf
or in your datadir
(usually /var/lib/mysql
or /usr/local/var
). 您可以在
/etc/my.cnf
或datadir
创建一个(通常是/var/lib/mysql
或/usr/local/var
)。
I usually use mysqladmin shutdown
(might need a -p
if you have a password set) and then a sudo mysqld_safe &
to start it up. 我通常使用
mysqladmin shutdown
(如果你设置了密码,可能需要一个-p
),然后是一个sudo mysqld_safe &
来启动它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.