Unable to create the MySQL database on linux server - mysql

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/

Related

Mysql Mariadb user not able to access DB

I created a schema and granted its permission to a specific user:
GRANT ALL PRIVILEGES ON USED_CARS.* TO ANDREW#LOCALHOST;
The database is created with root user and then granted these permissions to another user. now when I swith to another account I can list the schema with SHOW SCHEMAS; query however cannot switch to that DB with use USED_CARS; query.
Following error pops up:
ERROR 1044 (42000): Access denied for user 'ANDREW'#'localhost' to database 'USED_CARS'
What am I missing here? Thanks for the help in advance.
Sometimes depending on the configuration of server, you can use localhost or the ip:127.0.0.1
Could you try with this ...
GRANT ALL PRIVILEGES ON USED_CARS.* TO 'ANDREW'#'%';

unable to create database in mysql or via ssh

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 .

Mysql: new user access denied to database

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.

How to change/alter the mysql database user

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'#'%';

Access root for newly installed MySQL on nitrousio box?

EDIT- Turns out to be a silly question. The solution:
mysql -u root Don't put a -p as there is no password for fresh installs of MySQL root.
Original Question:
Autoparts just came out recently on nitrous: http://blog.nitrous.io/2013/09/18/introducing-autoparts-for-nitrous-io.html
and I ran the command $ parts install mysql to install mySQL...works great!
Now, how do I access mysql to setup a root user or other users?
mysql> CREATE DATABASE django_db;
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'django_db'
mysql> GRANT ALL ON django_db.* TO 'djangouser'#'localhost' IDENTIFIED BY 'mypassword';
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'django_db'
I don't know how to access mysql -u root -p because I don't know the root password, so I just used mysql to access the mysql from the terminal.
My end goal is to have the mysql setup on my box for a development and testing for my django web application.