开发者

Create a new database with MySQL Workbench

开发者 https://www.devze.com 2023-02-21 03:09 出处:网络
Being new to MySQL, I have installed the latest version of the MySQL Workbench (5.2.33). I would like to know how you can create a database with this application. In the Overview tab of the SQL editor

Being new to MySQL, I have installed the latest version of the MySQL Workbench (5.2.33). I would like to know how you can create a database with this application. In the Overview tab of the SQL editor there are few "MySQL Schema" displayed, are these sche开发者_开发技巧mas the existing databases?


  1. Launch MySQL Workbench.
  2. On the left pane of the welcome window, choose a database to connect to under "Open Connection to Start Querying".
  3. The query window will open. On its left pane, there is a section titled "Object Browser", which shows the list of databases. (Side note: The terms "schema" and "database" are synonymous in this program.)
  4. Right-click on one of the existing databases and click "Create Schema...". This will launch a wizard that will help you create a database.

If you'd prefer to do it in SQL, enter this query into the query window:

CREATE SCHEMA Test

Press CTRL + Enter to submit it, and you should see confirmation in the output pane underneath the query window. You'll have to right-click on an existing schema in the Object panel and click "Refresh All" to see it show up, though.


Click the database symbol with the plus sign (shown in the below picture). Enter a name and click Apply.

Create a new database with MySQL Workbench

This worked in MySQL Workbench 6.0


How to create database in MySQL Workbench 6.3

  1. In tab home (1) -> Right click on Local instance banner (2) -> Open Connection (3)

    Create a new database with MySQL Workbench

  2. Right click on the empty space in schema window (1) -> Create schema (2)

    Create a new database with MySQL Workbench

  3. Type name of database (1) -> Apply (2)

    Create a new database with MySQL Workbench


In MySQL Work bench 6.0 CE.

  1. You launch MySQL Workbench.
  2. From Menu Bar click on Database and then select "Connect to Database"
  3. It by default showing you default settings other wise you choose you host name, user name and password. and click to ok.
  4. As in above define that you should click write on existing database but if you don't have existing new database then you may choose the option from the icon menu that is provided on below the menu bar. Now keep the name as you want and enjoy ....


Those who are new to MySQL & Mac users; Note that, Connection is different than Database.

Steps to create a database.

Step 1: Create connection and click to go inside

Create a new database with MySQL Workbench

Step 2: Click on database icon

Create a new database with MySQL Workbench

Step 3: Name your database schema

Create a new database with MySQL Workbench

Step 4: Apply query

Create a new database with MySQL Workbench

Step 5: Your DB created, enjoy...

Create a new database with MySQL Workbench


If the create new schema icon is disabled in the workbench, it means that your MySQL service is not running.

Create a new database with MySQL Workbench

Please check if your MySQL service is running in the task manager.

Create a new database with MySQL Workbench


This answer is for Ubuntu users looking for a solution without writing SQL queries.

The following is the initial screen you'll get after opening it

Create a new database with MySQL Workbench

In the top right, where it says Administration, click in the arrow to the right

Create a new database with MySQL Workbench

This will show Schema (instead of Administration) and it's possible to see a sys database.

Create a new database with MySQL Workbench

Right click in the grey area after functions and click Create Schema...

Create a new database with MySQL Workbench

This will open the following where I'm creating a table named StackOverflow_db

Create a new database with MySQL Workbench

Clicking in the bottom right button that says "Apply",

Create a new database with MySQL Workbench

And in this new view click in "Apply" too. In the end you'll get a database called StackOverflow_db

Create a new database with MySQL Workbench


you can use this command :

CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name
  [create_specification] ...

create_specification:
    [DEFAULT] CHARACTER SET [=] charset_name
    | [DEFAULT] COLLATE [=] collation_name


For me there was a weird bug in Workbench where I had to click the icon multiple times until the "Apply" and "Revert" buttons showed

Create a new database with MySQL Workbench


first, you have to create Models. default model is sakila, so you have to create one. if you already created the new one, go to Database > Forward Engineer. then, your model will exist in local instance:80

Forward engineer is to create database in your choosed host!

0

精彩评论

暂无评论...
验证码 换一张
取 消