I have the mysql database user on server as rob and password something like rob123
And now i tried to create a database for user rob, so i logged in as
mysql -u rob -prob123
I can able to login successfully and when tried to create a database like below
create database hello;
i got below error
ERROR 1044 (42000): Access denied for user 'rob'#'%' to database 'hello'
So i logged in as default mysql user as root and logged in successfully
mysql -u root
Now i can able to create a database with create database hello; , but i need to change the user of this database 'hello' as rob and password as rob123.
So how to alter the user of the database ?
you need to create user and grant permissions:
use hello;
create user rob identified by 'rob';
grant all on rob.* to 'rob'#'%';
grant select on `mysql`.`proc` to 'rob'#'%';
Related
I m trying to create new database through mysql or ssh but on both m getting error
mysql : CREATE DATABASE porto;
Error : Access denied for user 'root'#'localhost' to database 'porto' on ssh : ERROR 1044 (42000): Access denied for user 'root'#'localhost' to database 'porto'
mysql> CREATE USER 'testuser'#'localhost' IDENTIFIED BY 'ecomaddon#42';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
mysql> SELECT User,Host From mysql.user;
ERROR 1142 (42000): SELECT command denied to user 'root'#'localhost' for table 'user'
Its problem of privilege but don't know how give root user all privilege ai had try all methods but got nothing.
You can try to access as root
mysql -h 127.0.0.1 -P 3306 -u root -p
If it still does not work follow this guide
https://www.a2hosting.com/kb/developer-corner/mysql/managing-mysql-databases-and-users-from-the-command-line
you may be login as root but the root#localhost is not allowed for the actions you are executing.
mysql>CREATE USER 'root'#'localhost' IDENTIFIED BY 'enter_your_password_here';
mysql>exit
then try logging-in again
I think it's rights issue & It can be resolved by re configuring again. Here's a steps to reconfigure it.
Stop the current MySQL server instance:
sudo service mysql stop
Use dpkg to re-run the configuration process that MySQL goes through on first installation. You will again be asked to set a root password.
sudo dpkg-reconfigure mysql-server-5.5
Thanks for reply to all
i had solve i
1. first login to new user.
2. give access all to that users by update command .
3. drop root user and rename second user to root.
main problem was : when we create root it didn't give grant_priv field access users .
I'm using MySQL Workbench, I have different databases and I want to copy all the tables from those databases to a new database called newDB, I don't have access to the root account, but I have user and password for every database by separate, I've exported correctly all the tables using the Data Export Wizard within MySQL Workbench, but when I'm in the newDB tab and I try to import the tables from one of the other databases using the Data Import Wizard I'm receiving this error:
ERROR 1044 (42000): Access denied for user 'userNewDB'#'%' to database 'db1'
The error message is very clear, I'm under newDB tab in MySQL Workbench and is trying to import those tables from a different database that doesn't recognize that username, is there any way that I could do this using a query and passing as parameters the user and password for db1? Let's say that the user for db1 is userdb1 and the password is passdb1. Is that possible or it is mandatory to do this under the root account that I don't have access to...
Grant all privileges to the user first:
GRANT ALL PRIVILEGES ON *.* TO 'user'#'localhost' WITH GRANT OPTION;
I'm using Mysql 5.5. I logged in mysql by root and created a new user.
Then I logged in using
mysql -u newuser -p
Then in mysql I entered
GRANT ALL PRIVILEGES ON db1.tablename TO 'newuser'#'localhost';
in order to access to the databases.
But there is an error message:
ERROR 1142 (42000): SELECT,INSERT,UP command denied to user 'newuser'#'localhost' for table 'tablename'
I even tried other commands such as GRANT CREATE or GRANT DROP, the same error keep showing.
ERROR 1142 (42000): CREATE,GRANT command denied to user 'newuser'#'localhost' for table 'tablename'
Can someone please help?
You logged into MySQL as root and created the new user, but you need to grant the permissions to the new user as well while logged in as root. Then you'll be able to login as newuser and execute statements.
I have only one user. I am logged with the same user and tried to create the database and getting the following error.
ERROR 1044 (42000): Access denied for user 'csatsurvey'#'localhost' to database 'demo'
By the above error I understood that I am have some access issues. How can I grant the permissions and crate the database with the same user.
step 1: login to your mysql -u root -p
step 2: basic syntax to permission
"GRANT permission ON database.table TO 'user'#'localhost';"
step 3: To grant any specific permission
GRANT CREATE ON . TO 'testuser'#'localhost';
CREATE is a permission
to more details visit to
http://www.liquidweb.com/kb/grant-permissions-to-a-mysql-user-on-linux-via-command-line/
I'm trying to create a database on my remote sql server - clearDB - on Heroku. I connected with this:
mysql --host='<<cleardbhostname>>' --user='<<lsdj234>> --password
My username and password are obtained from the result from running heroku config. When I tried to run
CREATE DATABASE mydb;
I got this:
ERROR 1044 (42000): Access denied for user '<<lsdj234>>'#'%' to database 'mydb'
When I ran SHOW GRANTS for current_user I got:
GRANT USAGE ON *.* TO '<<lsdj234>>'#'%' IDENTIFIED BY PASSWORD '*asfe4545235' WITH MAX_QUERIES_PER_HOUR 3600 MAX_USER_CONNECTIONS 10 |
| GRANT ALL PRIVILEGES ON `heroku_ljl4455lkj`.* TO '<<lsdj234>>'#'%'
What is happening? How do I resolve this?
The only database that your user can access (and even create) is heroku_ljl4455lkj
It can't create any other databases.