Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7550169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:08:39+00:00 2026-05-30T10:08:39+00:00

I am executing a Command mysql -uroot -proot -Bse select Concat(‘SHOW CREATE TABLE ‘,TABLE_SCHEMA

  • 0

I am executing a Command

mysql -uroot -proot -Bse "select Concat('SHOW CREATE TABLE ',TABLE_SCHEMA ,'.',TABLE_NAME,'\\G') from information_schema.tables where TABLE_SCHEMA Not IN('mysql','information_schema','performance_schema');"

I want output as

SHOW CREATE TABLE sakila.category\G
SHOW CREATE TABLE sakila.city\G
SHOW CREATE TABLE sakila.country\G
SHOW CREATE TABLE sakila.customer\G

But I am getting

SHOW CREATE TABLE sakila.categoryG
SHOW CREATE TABLE sakila.cityG
SHOW CREATE TABLE sakila.countryG
SHOW CREATE TABLE sakila.customerG

Why is this so? Where am I wrong?

UPDATE

If I write

mysql -uroot -proot -Bse "select Concat('SHOW CREATE TABLE ',TABLE_SCHEMA ,'.',TABLE_NAME,'\\\\G') from information_schema.tables where TABLE_SCHEMA Not IN('mysql','information_schema','performance_schema');"

I get output as

SHOW CREATE TABLE sakila.category\\G
SHOW CREATE TABLE sakila.city\\G
SHOW CREATE TABLE sakila.country\\G
SHOW CREATE TABLE sakila.customer\\G

But I only want \G, not \\G.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:08:40+00:00Added an answer on May 30, 2026 at 10:08 am

    You need an additional level of escaping: \\\\

    You give the query string th MySQL via a shell command line. The shell turns the \\\\ (\\ twice) into two \, i. e. \\. That is because it is enclosed in "s.

    MySQL sees the \\\\ as \\ and, as it has its own escaping, uses it as \.


    EDIT: I don’t understand why, but this doesn’t work with your query.

    But by fiddling around with it, one wasily finds out that both \\\\G and \\\G would be the way to go.

    Alas, the data is modified on output in the MySQL CLI client. As its output is escaped to allow for \0. \t etc. to be output, it as well has to escape the \ on output.

    With the CLI parameter -r or --raw, you can disable that behaviour. (Your s option, however, should be redundant, as it is included in B.) And maybe N wouldbe useful, disabling the headers.

    So use -Bre or -NBre instead of -Bse and you are perfectly fine with \\\\G.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When executing a multi-command script (for instance, a few CREATE TABLE commands and perhaps
I'm currently facing a weird problem while executing a command from my bash script.
I am able to backup mysql database via command line by executing the below
There is a bug that I found in MySql 5.5.19. When executing: select uuid(),
I have a table in a Mysql 5.1 schema. Statement for create this table
I am using the mysql admin GUI tool to create a table. Here is
I know that SqlContext.WindowsIdentity returns the current user that is executing the command (in
I have an awesome trouble with Gem. After executing this command: rm -f /usr/local/lib/ruby/gems/1.9.1/cache/*
I´m executing the following command grep bruno < bash.txt which gives me the right
I cannot get the example Python programs to run. When executing the Python command

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.