所以我将我的开发环境和生产环境迁移到postgresql,以便我可以部署到Heroku.安装mysql2psql gem后,初始化一个(postgresql)database.yml文件 - 我卡在运行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
Run Code Online (Sandbox Code Playgroud)
所以问题是如何重新启动我的mysql2服务器并指定query_cache_type = 1?
我试图用以下内容启动服务器并且它不起作用:
mysql --query_cache_type=1;
Run Code Online (Sandbox Code Playgroud)
尝试几个类似的命令后,我尝试启动服务器,然后在会话中执行:
mysql> SET GLOBAL query_cache_type = 1;
Run Code Online (Sandbox Code Playgroud)
但是我得到了:
ERROR 1651 (HY000): Query cache is disabled; restart the server with query_cache_type=1 to enable it
Run Code Online (Sandbox Code Playgroud)
这实际上是一个语法问题:我使用什么命令来启动我的sql server并使用query_cache_type = 1选项?
当我使用cin.get函数从cin获取输入时,它将自动更新输入文件中的读取位置.我该怎么做才能将读取位置返回到文件的开头,以便我可以再次接收输入?
比方说我有以下文件input.txt:
"向你的新世界问好"
以及以下get循环来获取input.txt文件:
while(cin.get(charTemp)){
numberOfChars++;
}
Run Code Online (Sandbox Code Playgroud)
我怎么能接受两次输入?