2

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

.

jkim44
  • 23
  • 1
  • 3

2 Answers2

4

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.

tadman
  • 208,517
  • 23
  • 234
  • 262
0

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

Upendra
  • 127
  • 1
  • 7