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
Related
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'
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.
Im trying to export a DB on amazons RDS but whenever i run the mysqldump command i get the error:
mysqldump: Got error: 1044: Access denied for user 'ec2'#'%' to database ‘DB_name’ when using LOCK TABLES
I dont know the right command to run in my mac terminal to change the lock permissions for the user.
can someone please help.
Try adding " --single-transaction "
mysqldump --single-transaction -u root mydbname > backup.sql
mysqldump requires at least the SELECT privilege for dumped tables,
SHOW VIEW for dumped views, TRIGGER for dumped triggers, and LOCK
TABLES if the --single-transaction option is not used.
http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
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/
I am trying to create a batch file to create a MySQL Database. So far, none of the information I am finding is working. Just for testing, this is what I am trying...
C:\>mysql -uroot -ppassword < CREATE DATABASE testdb;
C:\>mysql -uroot -ppassword mysql < CREATE DATABASE testdb;
No matter how I put it, I keep getting the error "The system cannot find the file specified". If I just put...
C:\>mysql -uroot -ppassword
It logs into the MySQL prompt fine. What exactly am I doing wrong?
I agree with the other posters, it's much better to put the schema into a file. However, here's how you can do it on the command line:
mysql -uroot -ppassword -e "CREATE DATABASE testdb"
acess as root user :
mysql -u root -p
it asks for password..enter your password
then
run the create command like this:
mysql> create database database_name;
It's better to write your MySQL inside a file and then import that file. That way, when you need to run it again (reinstalling or migrating) you have a record of the MySQL to run. The code I use for a file like this is as follows, which destroys anything that's already there, and then creates the database and assigns a dedicated user.
# uninstall if anything's already there
GRANT ALL PRIVILEGES ON *.* TO 'username'#'%';
DROP USER 'username'#'%';
DROP DATABASE IF EXISTS `tablename`;
# create the user
CREATE USER 'username'#'%' IDENTIFIED BY 'password';
CREATE DATABASE IF NOT EXISTS `tablename`;
GRANT ALL PRIVILEGES ON `tablename` . * TO 'username'#'%';
Try putting your sql into a text file, like 'createDb.sql' and then run:
mysql -uroot -ppassword < createDb.sql;