My OS is Ubuntu 16.04 LTS and I am deploying the sakila database for learning mysql and have done the following:
- Downloaded the file "sakila-db.tar.gz from https://downloads.mysql.com/docs/ to the directory "/tmp" with no problem
$ cd /tmp
- $ gzip -cd sakila-db.tar.gz | tar xvf - Files sakila-data.sql, sakila-schema.sql and sakila.mwb were extracted to diredctory "sakila-db"
$ cd sakila-db
$ mysql -u root -p < sakila-schema.sql
(command executed successfully)$ mysql -u root -p
(to grant privileges to user for the sakila database)mysql> GRANT CREATE, DROP, ALTER, INSERT, UPDATE, SELECT, DELETE, INDEX, CREATE VIEW, CREATE ROUTINE, ALTER ROUTINE, EXECUTE, TRIGGER, INDEX ON sakila.* TO 'jump'@'localhost';
(command executed successfully)
mysql> GRANT SUPER, RELOAD, FILE ON *.* TO 'ted'@'localhost';
(granting these global commands to user ted - command executed OK)- mysql> exit
Trying to populate the sakila tables with data from
sakila-data.sql
$ mysql -u ted -p < sakila-data.sql
Enter password:
ERROR 1044 (42000) at line 46412: Access denied for user 'ted'@'localhost' to database 'sakila'
This is my problem, can anyone help me solve this?
I found a solution to my problem by issuing the following commands: Connecting to mysql: $ mysql -u root -p; Issuing a global grant on the database: GRANT ALL PRIVILEGES ON . TO 'ted'@'localhost' WITH GRANT OPTION; Then exiting mysql; Issuing the command: $ mysql -u ted -p mysql> use mysql; but ... ERROR 1044 (42000): Access denied for user '' @ 'localhost' to database 'mysql'.