Anybody know how to create new database in DataGrip (database IDE from JetBrains)? Could not find in DataGrip Help page.
相关问题
- Jetbrains Datagrip cannot connect sql server witho
- sqlyog export query result as csv
- NOT DISTINCT query in mySQL
- NOT DISTINCT query in mySQL
- MySQL: conduct a basic search
You first define the database. File --> Data Sources and Drivers --> Click on the green '+' in the top left corner to select the database type. And then fill in all the settings in the 'General' tab.
For example for PostgreSQL:
Host: localhost
Database: postgres
User: postgres
Password: password
Once you are set up, Ctrl+Shift+F10 to open the console and you can type your SQL statements, e.g.:
I don't believe the existing answers cover MySQL... In MySQL, creating a new schema is equivalent to creating a new database. For this case, contextual-click (usually right-click) on your connection in the navigation tree and choose New | Schema. Give it a name and 'Execute in database".
The name of this schema will show up in the navigation tree and you can then add tables, data, etc.
The tricky part of creating a new database, is that you have to do it using a DataGrip "Data Source" where are are connected as a user that has the priviledge to create a database, which is generally the "admin" user that you added when you first installed Postgres which is connected to the main "postgres" database.
I like to keep track of all the commands I have run by attaching a new directory (File Menu | Attach Directory) and creating new files with descriptive names, such as "create_my_test_db.sql" and enter the sql to create the database:
When you want to execute this code, make sure that you are using the correct "console". DataGrip has a drop-down menu in the upper-right corner above your file menu, so make sure you have selected "postgres@localhost", since this is the user Data Source that has privileges to create a new database.
Similarly, to create a new user for this data base, create a new sql file "create_my_test_db_user.sql"
Then you can create a new Data Source, and set the properties to host = localhost, user = my_test_db_user, and password = keyboard_cat.
Go to the name of your connection (eg: cat-app@localhost) ,right-click and select Schema. Creating a Schema and Database are same in Mysql.
In DataGrip 2017.1 UI for this was introduced