所以我正在将我的开发环境和生产环境迁移到postgresql,以便我可以部署到Heroku。安装完mysql2psql gem后,初始化(postgresql)数据库。我被困在我运行mysql2psql的地方。运行它后,我得到以下内容:
/Library/Ruby/Gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/mysql_reader.rb:153:in `query': Query cache is disabled; restart the server with query_cache_type=1 to enable it
所以问题是我如何重新启动我的mysql2服务器并指定query_cache_type=1?
我尝试用以下命令启动服务器,但它没有工作:
mysql --query_cache_type=1;
在尝试了几个类似的命令之后,我尝试启动服务器,然后在会话中执行:
mysql> SET GLOBAL query_cache_type = 1;
但是唉,我得到:
ERROR 1651 (HY000): Query cache is disabled; restart the server with query_cache_type=1 to enable it
这真的是一个语法问题:我用什么命令来启动我的sql服务器与选项query_cache_type=1?
在Mac OS X 10.8中,my.cnf文件可能位于/usr/local/mysql-5.6.10-osx10.7-x86_64文件夹
使用
搜索终端$ find / -name my.cnf
在您的系统中找到它。
编辑您的my.cnf文件,在
末尾添加这一行query_cache_type=1
在System Preferences中重新启动mysqld,如果你已经安装了MySQL Preferences Pane (http://dev.mysql.com/doc/refman/5.1/en/macosx-installation-prefpane.html),或者在Terminal中写入
$ sudo /usr/local/mysql/support-files/mysql.server restart
然后用
登录mysql$ mysql -h localhost -u root -p
和写
mysql> SET GLOBAL query_cache_size=40000;
然后运行
$ mysql2psql
只需将其设置在my.cnf文件中,通常位于/etc?然后重启。
编辑:你还需要有一个query_cache_size设置,如果这两个设置中的一个设置为零,那么它将不会被启用