How to clear a SQL Table when Database has a point in its name (bash script)? [duplicate]
This question already has an answer here:
When to use single quotes, double quotes, and back ticks in MySQL
12 answers
The script is in /etc/cron.daily.
When I had database name = baseName and the table = tableName, the below script to empty the table worked well :
#!/bin/bash
mysql -u root --password=PASSWD -e "DELETE FROM baseName.tableName"
But I needed to rename the database in baseName.fr.value so I basically modified my script to
#!/bin/bash
mysql -u root --password=PASSWD -e "DELETE FROM baseName.fr.value.tableName"
But I got an You have an error in your SQL syntax, check the manual...
So what's the correct syntax when there's a . in the database name ?
mysql sql bash sql-delete
marked as duplicate by JNevill, mustaccio, Madhur Bhaiya, tripleee
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 16 '18 at 5:16
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
When to use single quotes, double quotes, and back ticks in MySQL
12 answers
The script is in /etc/cron.daily.
When I had database name = baseName and the table = tableName, the below script to empty the table worked well :
#!/bin/bash
mysql -u root --password=PASSWD -e "DELETE FROM baseName.tableName"
But I needed to rename the database in baseName.fr.value so I basically modified my script to
#!/bin/bash
mysql -u root --password=PASSWD -e "DELETE FROM baseName.fr.value.tableName"
But I got an You have an error in your SQL syntax, check the manual...
So what's the correct syntax when there's a . in the database name ?
mysql sql bash sql-delete
marked as duplicate by JNevill, mustaccio, Madhur Bhaiya, tripleee
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 16 '18 at 5:16
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Try putting square brackets around the full name
– user1178830
Nov 15 '18 at 20:33
@user1178830 neither[baseName.fr.value.tableName]nor[baseName.fr.value].tableNamework :/
– azro
Nov 15 '18 at 20:36
1
@user1178830 That's SQL-Server syntax. MySQL uses backticks.
– Barmar
Nov 15 '18 at 20:39
add a comment |
This question already has an answer here:
When to use single quotes, double quotes, and back ticks in MySQL
12 answers
The script is in /etc/cron.daily.
When I had database name = baseName and the table = tableName, the below script to empty the table worked well :
#!/bin/bash
mysql -u root --password=PASSWD -e "DELETE FROM baseName.tableName"
But I needed to rename the database in baseName.fr.value so I basically modified my script to
#!/bin/bash
mysql -u root --password=PASSWD -e "DELETE FROM baseName.fr.value.tableName"
But I got an You have an error in your SQL syntax, check the manual...
So what's the correct syntax when there's a . in the database name ?
mysql sql bash sql-delete
This question already has an answer here:
When to use single quotes, double quotes, and back ticks in MySQL
12 answers
The script is in /etc/cron.daily.
When I had database name = baseName and the table = tableName, the below script to empty the table worked well :
#!/bin/bash
mysql -u root --password=PASSWD -e "DELETE FROM baseName.tableName"
But I needed to rename the database in baseName.fr.value so I basically modified my script to
#!/bin/bash
mysql -u root --password=PASSWD -e "DELETE FROM baseName.fr.value.tableName"
But I got an You have an error in your SQL syntax, check the manual...
So what's the correct syntax when there's a . in the database name ?
This question already has an answer here:
When to use single quotes, double quotes, and back ticks in MySQL
12 answers
mysql sql bash sql-delete
mysql sql bash sql-delete
edited Nov 15 '18 at 20:43
Aaron Bertrand
211k27369407
211k27369407
asked Nov 15 '18 at 20:31
azroazro
11.4k41639
11.4k41639
marked as duplicate by JNevill, mustaccio, Madhur Bhaiya, tripleee
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 16 '18 at 5:16
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by JNevill, mustaccio, Madhur Bhaiya, tripleee
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 16 '18 at 5:16
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Try putting square brackets around the full name
– user1178830
Nov 15 '18 at 20:33
@user1178830 neither[baseName.fr.value.tableName]nor[baseName.fr.value].tableNamework :/
– azro
Nov 15 '18 at 20:36
1
@user1178830 That's SQL-Server syntax. MySQL uses backticks.
– Barmar
Nov 15 '18 at 20:39
add a comment |
Try putting square brackets around the full name
– user1178830
Nov 15 '18 at 20:33
@user1178830 neither[baseName.fr.value.tableName]nor[baseName.fr.value].tableNamework :/
– azro
Nov 15 '18 at 20:36
1
@user1178830 That's SQL-Server syntax. MySQL uses backticks.
– Barmar
Nov 15 '18 at 20:39
Try putting square brackets around the full name
– user1178830
Nov 15 '18 at 20:33
Try putting square brackets around the full name
– user1178830
Nov 15 '18 at 20:33
@user1178830 neither
[baseName.fr.value.tableName] nor [baseName.fr.value].tableName work :/– azro
Nov 15 '18 at 20:36
@user1178830 neither
[baseName.fr.value.tableName] nor [baseName.fr.value].tableName work :/– azro
Nov 15 '18 at 20:36
1
1
@user1178830 That's SQL-Server syntax. MySQL uses backticks.
– Barmar
Nov 15 '18 at 20:39
@user1178830 That's SQL-Server syntax. MySQL uses backticks.
– Barmar
Nov 15 '18 at 20:39
add a comment |
1 Answer
1
active
oldest
votes
In MySQL, you put backticks around database, table, or column names that contain special characters.
mysql -u root --password=PASSWD -e 'DELETE FROM `baseName.fr.value`.tableName'
Note that I changed from double quotes to single quotes, because backticks have special meaning to the shell when used inside double quotes.
See When to use single quotes, double quotes, and back ticks in MySQL and Difference between single and double quotes in Bash.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In MySQL, you put backticks around database, table, or column names that contain special characters.
mysql -u root --password=PASSWD -e 'DELETE FROM `baseName.fr.value`.tableName'
Note that I changed from double quotes to single quotes, because backticks have special meaning to the shell when used inside double quotes.
See When to use single quotes, double quotes, and back ticks in MySQL and Difference between single and double quotes in Bash.
add a comment |
In MySQL, you put backticks around database, table, or column names that contain special characters.
mysql -u root --password=PASSWD -e 'DELETE FROM `baseName.fr.value`.tableName'
Note that I changed from double quotes to single quotes, because backticks have special meaning to the shell when used inside double quotes.
See When to use single quotes, double quotes, and back ticks in MySQL and Difference between single and double quotes in Bash.
add a comment |
In MySQL, you put backticks around database, table, or column names that contain special characters.
mysql -u root --password=PASSWD -e 'DELETE FROM `baseName.fr.value`.tableName'
Note that I changed from double quotes to single quotes, because backticks have special meaning to the shell when used inside double quotes.
See When to use single quotes, double quotes, and back ticks in MySQL and Difference between single and double quotes in Bash.
In MySQL, you put backticks around database, table, or column names that contain special characters.
mysql -u root --password=PASSWD -e 'DELETE FROM `baseName.fr.value`.tableName'
Note that I changed from double quotes to single quotes, because backticks have special meaning to the shell when used inside double quotes.
See When to use single quotes, double quotes, and back ticks in MySQL and Difference between single and double quotes in Bash.
edited Nov 15 '18 at 20:47
azro
11.4k41639
11.4k41639
answered Nov 15 '18 at 20:41
BarmarBarmar
430k36253354
430k36253354
add a comment |
add a comment |
Try putting square brackets around the full name
– user1178830
Nov 15 '18 at 20:33
@user1178830 neither
[baseName.fr.value.tableName]nor[baseName.fr.value].tableNamework :/– azro
Nov 15 '18 at 20:36
1
@user1178830 That's SQL-Server syntax. MySQL uses backticks.
– Barmar
Nov 15 '18 at 20:39