unable to truncate a table using remote login - mysql

I use remote login to connect to the database (residing on AWS). I'd like to truncate one of my tables. But this command does not seem to work on bash:
mysql --login-path=remote --database=marketing 'truncate table my_test_table'
I get the message
ERROR 1044 (42000): Access denied for user 'mdb_updater'#'%' to
database 'truncate table pedram_test_table'
mdb_updater is my username on the database.
This is when I can successfully run mysqlimport and mysqldump using the same credentials.

MySQL cli treats positional argument as database name, pass statement you want to run with --execute option:
mysql --login-path=remote --database=marketing --execute 'truncate table my_test_table'

Related

MySQL Create View

I tried to create a view for the table VIEW in information_schema.
CREATE OR REPLACE VIEW Research as
select * from VIEWS;
But I'm getting an error like:
Error Code: 1044. Access denied for user 'root'#'localhost' to database 'information_schema'
What is the problem here? I can select other tables from the schema.
you should run mysql -u root -p in bash, not at the MySQL command-line. If you are in mysql, you can exit by typing exit.
NOTE: use 'quit' to exit the mysql,then you will be in bash

MYSQL: mysqldump returns empty after import

I need some help, why is it that after importing an mysqldump (table) at first you can see result, but when you exit
mysql -uroot -proot
and select again the table then check, it returns empty.
first connect mysql by below command-
mysql -uroot -proot
Note: assuming root is password of root user.
Now connect to database in which you imported table-
use my_db;
Now check your table by-
show tables;
or
show tables like 'my_table'
If still getting error then show how you import data and show first few lines of your backup if possible.
Or start mysql command shell using:
>mysql -u youruser -p yourdatabase
and then check up your table.
mysql>select * from yourtable;
P.S If you didn't choose any database you get appropriate error 1046:
No database selected.
If you don't get such error message and see you table empty YOU CHOSE WRONG DATABASE.

ERROR When Importing SQL File into MySQL Database

I'm trying to import an SQL file I have on a server and put it into the database. But I keep failing and it gives me an error.
This is the command and error I get:
try logging into mysql first
mysql -p username
enter your password:
mysql> source yourfile.sql;

Mysql Workbench priveleges, data import

When I try to change the priveleges on a mysql db I get the following error:
Please make sure the used account has rights to the MySQL grant tables. Error executing 'DESCRIBE mysql.db'
Is this also why it will not let me import tables in from another DB? When i try I get the error:
Operation failed with exitcode 1
09:20:16 Restoring D:\design and photos\boo.com\db dump\070113.sql
Running: mysql.exe --defaults-extra-file="c:\users\darren\appdata\local\temp\tmpslubjs.cnf" --host=87.117.239.19 --user=boo8_yu52 --port=3306 --default-character-set=utf8 --comments < "D:\design and photos\boo.com\db dump\070113.sql"
ERROR 1044 (42000) at line 1: Access denied for user 'boo8_yu52'#'%' to database ' boo8_6652'
It does however let me create tables manually. Can't work it out at all.
make sure that the account you are using is granted with grant option
and the account should have permissions on mysql database in which the db grant table exits
or the best way is to assign the permission with the root account
see the link below may be useful for you
http://blog.loftninjas.org/2008/04/22/error-1044-42000-at-line-2-access-denied-for-user-root-to-database-db/

Export DB using MySQL Console error in syntax

I'm using WAMP Server in a local PC.
I'm trying to export a big database using MySQL console but its just not working. I always get a syntax error 1064
The queries I tried:
mysqldump -u USER -p DATABASE > backup.sql;
mysqldump -u USER -pPASSWORD DATABASE > backup.sql;
(of course I'm replacing USER, PASSWORD and DATABASE with real values)
I also tried some more similar queries but I'm getting the same syntax error every time.
Please help!!!!!
You should type this in your command prompt not in MySQL console.
mysqldump is an application not MySQL command.