How can I list exactly which privileges I have instead of just getting 'ALL' ?Ĭan anyone suggest a way I can try to track down what is wrong?īTW I don't know if they executed flush privileges after doing the grant or not. Should I be able to do these things if I really have 'ALL privileges'? I can't select from several other system tables either, eg user I get the error SELECT command denied to user ip address' for table 'db' I get the error Access denied you need (at least one of) the CREATE USER privilege(s) for this operationĪnd if I try to see exactly what privileges I have using SELECT USER FROM mysql.db WHERE db = 'my_database_name' Returns GRANT ALL PRIVILEGES ON `my_database_name`.* TO ip address'īut if I try to create a user for my database using command such as CREATE USER IDENTIFIED BY 'password' They say they have given all privileges to all users (I'm the only user) You will just have to maintain its integrity.I am trying to resolve issues created when my ISP moved my database from a shared server to dedicated cloud storage. Going forward, you can user with the same rights as and you have hidden the password well. This will place you at the line where the command to print the PASSWORD function from text was done. Once you enter into vi, run /SELECT PASSWORD, hit enter. Step 03) Remove the commands from the audit history of mysql.Įvery time you login to mysql, the commands are recorded in a file called. The first line SET SQL_LOG_BIN=0 simply prevents the command from being recorded in the binary logs if you have binary logging enabled. This creates the user and sets his password. GRANT ALL PRIVILEGES ON *.* to IDENTIFIED BY PASSWORD '41-character MD5-like string' Step 02) As login to mysql and run SET SQL_LOG_BIN=0 This will return a 41-character MD5-like string. Step 01) As login to mysql and run SELECT PASSWORD('creatorpassword') * TO you seriously do not want to user create the user as follows: Mysql -u$rootuser -p$rootpass -e "GRANT ALL PRIVILEGES ON $dbname. Mysql -u$rootuser -p$rootpass -rs -e "CREATE DATABASE IF NOT EXISTS $dbname " Mysql -u$rootuser -p$rootpass -rs -e "GRANT USAGE ON *.* TO IDENTIFIED BY '$dbpass' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 " You do not have permission to create a new database even if it starts with lamp. Mysql -u$rootuser -p$rootpass -rs -e "CREATE USER IDENTIFIED BY '$dbpass' " You have grants to do things in any existing database that starts with lamp. With these things in mind, this is how you can create new users with its own database: rootuser=root However, it is not even necessary because the GRANT command internally performs FLUSH PRIVILEGES. Here is something additional: Only can perform FLUSH PRIVILEGES. A superuser (such as must perform the first three lines. The first three(3) lines cannot be performed by $myuser because. Look at the order of things: mysql -u$myuser -p$mypass -rs -e "CREATE USER IDENTIFIED BY '$dbpass' " The problem here is very straightforward. So, what privilege is 'creator' missing ? I want him to have as minimal privileges as possible. When I login as 'creator', i get same errors which is odd since 'creator' has GRANT privilege. I get ERROR 1044 (42000) at line 1: Access denied for user to database 'newdb'. * TO -u$myuser -p$mypass -rs -e "FLUSH PRIVILEGES " Mysql -u$myuser -p$mypass -rs -e "GRANT ALL PRIVILEGES ON $dbname. Mysql -u$myuser -p$mypass -rs -e "CREATE DATABASE IF NOT EXISTS $dbname " * TO IDENTIFIED BY '$dbpass' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 " Mysql -u$myuser -p$mypass -rs -e "GRANT USAGE ON *. Mysql -u$myuser -p$mypass -rs -e "CREATE USER IDENTIFIED BY '$dbpass' " Script looks something like this: myuser=creator I gave him INSERT, SELECT, UPDATE, CREATE, CREATE USER, GRANT privileges, but I can't grant access to create a database for the new user. Since I don't want to do use mysql root account, I've created a new user (let's call him 'creator'). I am trying to write a simple shell script to create new mysql user and database for this user.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |