Trying to edit the my.cnf file in mysql and it does not work

问题: I'm attempting to use cat /etc/my.cnf in mysql but when I do this, it just shows -> wanting me to keep putting in inputs. However, when I put a semicolon at the end....

问题:

I'm attempting to use cat /etc/my.cnf in mysql but when I do this, it just shows -> wanting me to keep putting in inputs.

However, when I put a semicolon at the end.

cat /etc/my.cnf;

it throws an error.

How can I edit the /etc/my.cnf file?

I'm running this on terminal on a Mac and I got into the mysql server by using the command

sudo /usr/local/mysql/bin/mysql -u root

.


回答1:

Are you typing this in to the mysql> shell? If so, UNIX-shell commands like cat won't do anything useful. These aren't commands MySQL knows how to deal with.

You need to run these in a plain Terminal (shell) window outside of MySQL.

By default most systems launch the bash shell which has access to command-line tools like vi, etc. The MySQL shell is SQL only.


回答2:

It seems you are trying to edit MySQL configuration from MySQL shell but that will not work. Follow below steps to edit the file

  1. Open terminal and type below command to open mysql config file in textedit
  2. sudo nano /etc/my.cnf
  3. Save the file and restart MySQL

Hope this helps you

  • 发表于 2019-02-27 20:38
  • 阅读 ( 187 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除