LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 04-20-2012, 01:07 PM   #1
GraysonPeddie
Member
 
Registered: Jul 2008
Location: Tallahassee, FL 32304
Distribution: Bebian Sid for server, KXStudio 12.04 Beta 1 for desktop
Posts: 33

Rep: Reputation: 1
MySQL: Need To Escape "!" In MySQL Prompt


Let's say that you're in a MySQL prompt and you are trying to create a user and grant a single database access to the user.

Example:

Code:
CREATE USER `ecommerce` IDENTIFIED BY `tH!s!SmYP@s$w0rDd0N0tUs3!T';
If I try to execute it, I will be stuck in > like this:

Code:
mysql> CREATE USER `ecommerce` IDENTIFIED BY `tH!s!SmYP@s$w0rDd0N0tUs3!T';
    `>
    `>
    `>
    ...
So how can I escape the exclamation mark?

"\!" wouldn't work because I'll get:

Code:
Unknown command '\!'.
Pardon me if this question have already been asked, but I've searched in Google for quite a while and I couldn't find what I'm looking for.

PS: If only I can create tags for exclamation mark and exclamation point. For someone searching in the Internet with the same problem that I have can find my thread a lot quickier with the two tags that I couldn't create.
 
Old 04-20-2012, 01:24 PM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 15,105

Rep: Reputation: 2720Reputation: 2720Reputation: 2720Reputation: 2720Reputation: 2720Reputation: 2720Reputation: 2720Reputation: 2720Reputation: 2720Reputation: 2720Reputation: 2720
Quote:
Originally Posted by GraysonPeddie View Post
Let's say that you're in a MySQL prompt and you are trying to create a user and grant a single database access to the user.
Example:
Code:
CREATE USER `ecommerce` IDENTIFIED BY `tH!s!SmYP@s$w0rDd0N0tUs3!T';
If I try to execute it, I will be stuck in > like this:
So how can I escape the exclamation mark?

"\!" wouldn't work because I'll get:
Code:
Unknown command '\!'.
Pardon me if this question have already been asked, but I've searched in Google for quite a while and I couldn't find what I'm looking for.
Two problems: you're using back-ticks not single quotes, and you're putting something around the user ID. This:
Code:
CREATE USER ecommerce IDENTIFIED BY 'tH!s!SmYP@s$w0rDd0N0tUs3!T';
..works fine.
 
1 members found this post helpful.
Old 04-20-2012, 01:30 PM   #3
GraysonPeddie
Member
 
Registered: Jul 2008
Location: Tallahassee, FL 32304
Distribution: Bebian Sid for server, KXStudio 12.04 Beta 1 for desktop
Posts: 33

Original Poster
Rep: Reputation: 1
Thanks for your help. My SQL knowledge is getting a little bit rusty.

I saw from the web page in step 3:

Code:
CREATE USER ‘aspnet’ IDENTIFIED by ‘aspnetpassword’;
...which gave me a problem with user creation in MySQL.

Last edited by GraysonPeddie; 04-20-2012 at 01:34 PM.
 
  


Reply

Tags
command, escape, mysql, unknown


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL setup without "mysql.server" in CentOS5 Ericxx Linux - Server 3 07-16-2010 03:51 AM
yum install php-mysql fails with mysql 5.1 - "Error: mysql conflicts with MySQL" rebelde Linux - Software 2 03-13-2009 11:32 AM
How to overcome the RPM "mysql-5.0.27-1.fc6" conflict with mysql database starting kamakshiganesh Linux - General 0 10-22-2007 08:07 AM
Buzilla issue: "Can't connect to local MySQL server through socket '/tmp/mysql.sock'" vitopn Linux - General 3 05-21-2007 11:13 AM
MySQL setup stops at command "./configure --prefix=/usr/local/mysql" k41184 Linux - Software 1 05-20-2004 03:44 PM


All times are GMT -5. The time now is 12:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration