What does the ( ' > ) symbol mean in the command line in MySQL? - mysql

I'm new to sql and for some reason, the arrow symbol ( -> ) that I am used to seeing in teh command line, which mean it is ready for input, is now displayed as ( '> ) and it does not accept commands. What does it mean and how do I get back to ( -> ) ?
Thanks

It means that it is treating any input which follows as part of a string literal, until it encounters a(n unescaped) string termination quote ' character.
This will have happened because you previously began the string literal with such a string termination quote character. For example:
mysql> SELECT foo
-> FROM tbl
-> WHERE bar LIKE 'somestring
'> this is still part of somestring'
-> ;

find the attached image
use '/ command and press enter then it will go on next line starting with ->
then use ; and press enter.
it happens if there is unbalanced '(single quote) in query.

It means you have an incomplete query. Most likely it's something related to a missing quotation, semi-colon at the end, or parentheses aren't closed.

You can exit the query with: '\c
Not sure what happens to the query but it gets you back to the mysql> prompt.

enter image description here
As you can see, I encountered the same issue, the solution is :
type '> in the command line, then insert some command as I did(please refer to the picture attached), and then the new line starts.

Related

why am I not able to do anything after this?

when using mysql command line, I forgot to put a ' in the varchar input and this is the result. No matter how many times I try to enter some other things nothing is happening. Can anyone tell me why this happening?
The mysql command line program is waiting for you to complete an incomplete quoted string; it shows > continuation line prompts.
Either finish the string with a closing ', or better, use <ctrl>-c to abandon your input and try again.

MYSQLi search and replace with a quoted font name

When building my web site I initially used the font Verdana quite a bit. I now wish to go through the mysql database and change all instances of :
font-family: Verdana;
to
font-family: 'Open Sans', sans-serif;
BUT when I initially tried a search and replace function within the phpMyAdmin panel the system balked over the quoted 'Open Sans'. I had a similar response when I entered a mysql command in the Run SQL query/queries window.
I have looked around the StackOverflow site and I saw some references to possibly using a \ in front of the quotes, but it didn't seem to actually apply in the situation I am trying to do a search and replace.
Any hints on what the mysql command needs to be in this type of situation..
Thanks in advance
Write it as a SELECT statement first. We can use the MySQL REPLACE function. https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_replace
e.g.
SELECT t.mycol AS oldval
, REPLACE(t.mycol,'font-family: Verdana;','font-family: ''Open Sans'', sans-serif;') AS newval
-- ^ ^^ ^^ ^
FROM mytable t
WHERE t.mycol LIKE '%font-family: Verdana;%'
Note that single quote characters in a string literal can be specified by two single quote characters.
As a demonstration, consider:
SELECT 'It''s good' AS foo
-- ^ ^^ ^
Once we have a tested and verified expression for newval, we can use that expression in an UPDATE statement
UPDATE mytable t
SET t.mycol = REPLACE(t.mycol,'font-family: Verdana;','font-family: ''Open Sans'', sans-serif;')
WHERE t.mycol LIKE '%font-family: Verdana;%'
Note that this will replace only the first occurrence of the string in mycol. A subsequent execution will find the next occurrence of the search string, and replace that.
Also note that REPLACE performs a case-sensitive match.

enter key produces " '> " in MYSQL Console

In the MYSQL Console, I was attempting to add multiple values to a table and in an effort to start a new line, I selected shift+enter which produced '>. Now, every time I hit enter, I get '> rather than inserting my values or really being able to do anything now. How do I stop this?
It means you have opened a quote ' and did not closed it. Add another quote ' to close the opened one, add a semicolon ; to end the command and hit enter to execute it (you maybe get a syntax error, it the opened quote must be closed earlier).

what does it mean when "> is returned on command line? [duplicate]

I'm new to sql and for some reason, the arrow symbol ( -> ) that I am used to seeing in teh command line, which mean it is ready for input, is now displayed as ( '> ) and it does not accept commands. What does it mean and how do I get back to ( -> ) ?
Thanks
It means that it is treating any input which follows as part of a string literal, until it encounters a(n unescaped) string termination quote ' character.
This will have happened because you previously began the string literal with such a string termination quote character. For example:
mysql> SELECT foo
-> FROM tbl
-> WHERE bar LIKE 'somestring
'> this is still part of somestring'
-> ;
find the attached image
use '/ command and press enter then it will go on next line starting with ->
then use ; and press enter.
it happens if there is unbalanced '(single quote) in query.
It means you have an incomplete query. Most likely it's something related to a missing quotation, semi-colon at the end, or parentheses aren't closed.
You can exit the query with: '\c
Not sure what happens to the query but it gets you back to the mysql> prompt.
enter image description here
As you can see, I encountered the same issue, the solution is :
type '> in the command line, then insert some command as I did(please refer to the picture attached), and then the new line starts.

How to remove double quote character in MySQL

I've been used the solution, but it cannot solved for special character.
I've tried
SELECT address FROM myDatabase.users
where substring(address,1,1) = '"';
What should I do to remove or change any special character or specific character in database like that??
anyway, after I ask my friend, he show me that the error come from setting in mysql workbench, I should to unselect "Safe Updates" check box in Edit >> Preferences >> SQL Editor >> Query Editor. thanks for the answer.
you could use the REPLACE function, so something like:
UPDATE myDatabase.users
SET address = REPLACE( address, '"', '' )
WHERE address LIKE '"%';