Error 1046 3d000 No Database Selected Grant
Contents |
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might error 1046 (3d000) no database selected mysql have Meta Discuss the workings and policies of this site About error 1046 no database selected phpmyadmin Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads no database selected mysql command line with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to
No Database Selected Mysql Php
improve their database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Error 1046 Mariadb: No database selected up vote 3 down vote favorite 1 GRANT error 1046 3d000 no database selected change password ALL ON my-database.* TO my-user@10.0.0.1 IDENTIFIED BY 'password'; ERROR 1046 (3D000): No database selected Ok, I have created a database with a "-" on the name (did the same thing on the user)... then when I try to set the grants on it the database wont work. If I use the base the error is different MariaDB [(none)]> use my-base Database changed MariaDB [my-base]> GRANT ALL ON 'my-base'.* TO 'my-user'@'10.0.0.1' IDENTIFIED BY 'password'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''my-base'.* TO 'my-user'@'10.0.0.1' IDENTIFIED BY 'password'' at line 1 MariaDB [my-base]> mariadb share|improve this question edited Mar 8 at 22:54 RolandoMySQLDBA 107k15138274 asked Oct 19 '12 at 14:27 maniat1k 1702516 1 In regards to the second error if you set your database, if you're not running in ANSI-quote sql_mode, ' doesn't escape a database object. Use the back tick ` –Derek Downey Oct 19 '12
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow #1044 - access denied for user the company Business Learn more about hiring developers or posting ads with us Stack
Error 1044 (42000): Access Denied For User
Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of
Error 1046 Citrix
4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ERROR 1046 (3D000): No database selected while creating user up vote 0 down vote favorite When I create http://dba.stackexchange.com/questions/27245/error-1046-mariadb-no-database-selected a admin user with: GRANT ALL ON * TO my_name@localhost IDENTIFIED BY 'my_passwd' WITH GRANT OPTION I received the error message "ERROR 1046 (3D000): No database selected". mysql mysql-error-1064 share|improve this question edited Nov 19 '14 at 14:12 Lars 1,186823 asked Nov 19 '14 at 13:56 user2823470 312 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote accepted You should be saying it like below by qualifying http://stackoverflow.com/questions/27018653/error-1046-3d000-no-database-selected-while-creating-user it with database name. Check MySQL Documentation for more information. GRANT ALL ON db_name.* So for your case, GRANT ALL ON db1.* TO my_name@localhost IDENTIFIED BY 'my_passwd' WITH GRANT OPTION; share|improve this answer answered Nov 19 '14 at 13:59 Rahul 43.4k63462 or for all databases use GRANT ALL ON *.* ... –Lars Nov 19 '14 at 14:04 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged mysql mysql-error-1064 or ask your own question. asked 1 year ago viewed 6689 times active 1 year ago Related -2Syntax Error in Create Function2Importing using MySQL WorkBench… error ERROR 1046 (3D000)0Error Updating Database with PHP0You have an error in your SQL syntax while doing a basic SELECT0MySQL Error #1064 from Create Table1MySQL Error: #1046 - No database selected-1Create procedure ERROR 1046 (3D000): No database selected-1SQLSTATE[3D000]:1046 - No database selected0SQL syntax error when adding a user to the database through php0codeigniter 3.1 PDO mysql Error Number: 3D000/1046 No database selected Ho
?> Home › MySQL database and user creation from the command line MySQL database and user creation from the command line Submitted by Benjamin Melançon on http://data.agaric.com/mysql-database-and-user-creation-from-command-line August 27, 2007 - 7:50pm in How to Complete MySQL On https://wellrounded.wordpress.com/2007/04/25/mysql-create-a-new-database-and-grant-all-to-a-specific-user/ Agaric's test server, i need to log into MySQL as root to do these grant commands. /usr/local/mysql/bin/mysql -uroot -p On Debian, simply mysql -uroot -p worked. You have to put in your root password, of course. (And the lack of a space between -u no database and root is not a typo.) In here, you can: SHOW DATABASES; CREATE DATABASE example_database; GRANT ALL ON example_database.*
TO [emailprotected] IDENTIFIED BY 'p4ssw0rd'; Credit: http://www.vbulletin.com/docs/html/main/cli_database And quit gets you out of there. Related: http://agaricdesign.com/backing-up-restoring-making-test-databases-with-mysql-command-line A note about database names with dashes It helps so much no database selected to use the correct commands. Dashed database names can be quoted with backticks (`), but be careful to include only the database and not the table wildcard when granting privileges. If MySQL gives a "No database selected" error on a GRANT statement, that is a clue that something is wrong. mysql> GRANT ALL PRIVILEGES ON `drupal-sdl-test.*` TO 'sdl'; ERROR 1046 (3D000): No database selected mysql> GRANT ALL PRIVILEGES ON `drupal-sdl-test`.* TO 'sdl'; Query OK, 0 rows affected (0.14 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) Searched words: command line creating a mysql database mysql command line make new user database bash shell Unix Linux mysql create database grant all privileges mysql mariadb Comments Post new comment Your name: * E-mail: * The content of this field is kept private and will not be shown publicly. Homepage: Subject: Comment: * You may post code using ...
(generic) or (highlighted PHP) tags.You can use Markdown syntax to format and st
specificuser Posted on April 25, 2007 by swinful Time and time again, I find myself looking up the "grant all" syntax after creating a new database in MySQL with mysqladmin. Since getting into the fold of using RubyOnRails, many sample databases will be created as I play along with the examples in my Agile book. Currently, MySQL version is: 5.0.33-log FreeBSD port: mysql-server-5.0.33 Create a database with mysqladmin: swinful@thinkpad> mysqladmin -u root -v create swinful_db Create a database from mysql prompt as root: swinful@thinkpad> mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 38 Server version: 5.0.33-log FreeBSD port: mysql-server-5.0.33 Type ‘help;' or ‘\h' for help. Type ‘\c' to clear the buffer. mysql> create database swinful_db; Query OK, 1 row affected (0.03 sec) Grant all permissions to user swinful on the new db: mysql> grant all on swinful_db.* to ‘swinful'@localhost identified by ‘swinfuls_password'; Query OK, 0 rows affected (0.05 sec) As you have noticed, the root password for MySQL is null. Since I am the only one using my laptop, this does not bother me. But, it is good habit to always use passwords. Change MySQL root password with mysqladmin: swinful@thinkpad> mysqladmin -u root password "roots_newpassword" Now, if I try to connect as before it will fail: swinful@thinkpad> mysql -u root ERROR 1045 (28000): Access denied for user ‘root'@'localhost' (using password: NO) Interested to know if mysqladmin with let me make root's password null again. swinful@thinkpad> mysqladmin -u root password mysqladmin: connect to server at ‘localhost' failed error: ‘Access denied for user ‘root'@'localhost' (using password: NO)' -=~=- swinful@thinkpad> mysqladmin -u root password "" mysqladmin: connect to server at ‘localhost' failed error: ‘Access denied for user ‘root'@'localhost' (using password: NO)' -=~=- swinful@thinkpad> mysqladmin -u root password NULL mysqladmin: connect to server at ‘localhost' failed error: ‘Access denied for user ‘root'@'localhost' (using password: NO)' Maybe I need to specify the root password:) swinful@thinkpad> mysqladmin -u root -p password NULL Enter password: Ok, now the root password is "NULL". Below is what I originally intended. swinful@thinkpad> mysqladmin -u root -p password "" En