{"id":10087,"date":"2024-04-06T12:05:31","date_gmt":"2024-04-06T09:05:31","guid":{"rendered":"https:\/\/sunucun.com.tr\/bilgi\/?post_type=dt_articles&#038;p=10087"},"modified":"2026-11-12T17:22:32","modified_gmt":"2026-11-12T14:22:32","slug":"creating-a-mysql-database","status":"publish","type":"post","link":"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/","title":{"rendered":"What Is MySQL Workbench and How to Use It: Create a Database and Tables"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_90 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#What_Is_MySQL_Workbench_Used_For\" >What Is MySQL Workbench Used For?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#How_to_Download_and_Install_MySQL_Workbench\" >How to Download and Install MySQL Workbench<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#Connecting_to_a_Server\" >Connecting to a Server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#Creating_a_Database_in_MySQL_Workbench\" >Creating a Database in MySQL Workbench<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#Creating_Tables_and_Running_Queries\" >Creating Tables and Running Queries<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#Creating_a_Database_from_the_Command_Line\" >Creating a Database from the Command Line<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#Backing_Up_and_Restoring\" >Backing Up and Restoring<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#MySQL_Workbench_or_phpMyAdmin\" >MySQL Workbench or phpMyAdmin?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#Frequently_Asked_Questions\" >Frequently Asked Questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#Is_MySQL_Workbench_free\" >Is MySQL Workbench free?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#Does_MySQL_Workbench_work_with_MariaDB\" >Does MySQL Workbench work with MariaDB?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#Why_do_I_get_%E2%80%9CCannot_connect_to_database_server%E2%80%9D\" >Why do I get &#8220;Cannot connect to database server&#8221;?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/sunucun.com.tr\/blog\/creating-a-mysql-database\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n\n<p class=\"wp-block-paragraph\"><strong>Short answer:<\/strong> MySQL Workbench is Oracle&#8217;s official desktop tool for managing MySQL databases through a graphical interface. It brings writing and running SQL queries, creating databases and tables, designing schemas (data modelling), managing users and taking backups into one program. The Community Edition is free and runs on Windows, macOS and Linux.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"768\" height=\"422\" class=\"wp-image-10084\" src=\"https:\/\/sunucun.com.tr\/blog\/wp-content\/uploads\/2024\/04\/mysql-nedir.webp\" alt=\"Creating a database with MySQL Workbench\" srcset=\"https:\/\/sunucun.com.tr\/blog\/wp-content\/uploads\/2024\/04\/mysql-nedir.webp 768w, https:\/\/sunucun.com.tr\/blog\/wp-content\/uploads\/2024\/04\/mysql-nedir-300x165.webp 300w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Is_MySQL_Workbench_Used_For\"><\/span>What Is MySQL Workbench Used For?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">According to the official MySQL documentation, Workbench&#8217;s functionality falls into five main areas:<\/p>\n\n\n\n<div class=\"snc-table-wrap\"><table>\n<thead><tr><th>Area<\/th><th>What it does<\/th><\/tr><\/thead>\n<tbody>\n<tr><td>SQL development<\/td><td>Manages server connections; writes and runs SQL queries and shows results in an editable grid<\/td><\/tr>\n<tr><td>Data modelling<\/td><td>Designs the database schema as a diagram; generates a database from the model (forward engineering) or a model from a database (reverse engineering)<\/td><\/tr>\n<tr><td>Server administration<\/td><td>Manages users and privileges, backs up and restores, monitors server health and performance<\/td><\/tr>\n<tr><td>Data migration<\/td><td>Moves tables and data from Microsoft SQL Server, Access, PostgreSQL, SQLite and others to MySQL<\/td><\/tr>\n<tr><td>Enterprise features<\/td><td>MySQL Enterprise Backup, Firewall and Audit support in the paid Commercial Edition<\/td><\/tr>\n<\/tbody><\/table><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re new to MySQL and databases, start with our <a href=\"https:\/\/sunucun.com.tr\/blog\/what-is-mysql\/\">what is MySQL<\/a> article.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Download_and_Install_MySQL_Workbench\"><\/span>How to Download and Install MySQL Workbench<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Download from the official page:<\/strong> choose your operating system at dev.mysql.com\/downloads\/workbench (Windows MSI, macOS, Debian\/Ubuntu and generic Linux packages). If you&#8217;re asked to sign in with an Oracle account, use the &#8220;No thanks, just start my download&#8221; link to download without one.<\/li>\n<li><strong>Windows prerequisites:<\/strong> the download page states that Windows needs Microsoft .NET Framework 4.5 and the Visual C++ Redistributable (Visual Studio 2019 or later); the installer fails if they&#8217;re missing.<\/li>\n<li><strong>Install:<\/strong> on Windows run the MSI and choose &#8220;Complete&#8221;; on macOS drag the app from the .dmg into Applications; on Ubuntu install the downloaded .deb with <code>sudo apt install .\/package-name.deb<\/code>.<\/li>\n<li><strong>The server is separate:<\/strong> Workbench is only a client; you need a MySQL server to connect to. To install a server on your own computer, follow our <a href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-mysql-installation-steps-for-windows-macos-and-linux\/\">how to install MySQL<\/a> guide.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Connecting_to_a_Server\"><\/span>Connecting to a Server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When you open Workbench, click the <strong>+<\/strong> icon next to &#8220;MySQL Connections&#8221; on the home screen and enter the connection details:<\/p>\n\n\n\n<div class=\"snc-table-wrap\"><table>\n<thead><tr><th>Field<\/th><th>Local MySQL<\/th><th>Remote server (<a href=\"https:\/\/sunucun.com.tr\/vds-sunucu\" data-internallinksmanager029f6b8e52c=\"133\" title=\"Tahsisli kaynakl\u0131 sanal sunucu \u00e7\u00f6z\u00fcmleri\">VDS<\/a>\/<a href=\"https:\/\/sunucun.com.tr\/vps-sunucu\" data-internallinksmanager029f6b8e52c=\"132\" title=\"Sanal sunucu se\u00e7eneklerini inceleyin\">VPS<\/a>)<\/th><\/tr><\/thead>\n<tbody>\n<tr><td>Connection Method<\/td><td>Standard (TCP\/IP)<\/td><td>Standard TCP\/IP over SSH (recommended)<\/td><\/tr>\n<tr><td>SSH Hostname \/ Username<\/td><td>\u2014<\/td><td>Server IP address:22 and your SSH user<\/td><\/tr>\n<tr><td>MySQL Hostname<\/td><td>127.0.0.1<\/td><td>127.0.0.1 (through the SSH tunnel)<\/td><\/tr>\n<tr><td>Port<\/td><td>3306<\/td><td>3306<\/td><\/tr>\n<tr><td>Username<\/td><td>root or your own user<\/td><td>Your database user<\/td><\/tr>\n<\/tbody><\/table><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Use &#8220;Test Connection&#8221; to check it, then save. Connecting over SSH gives you a secure connection without exposing port 3306 to the internet; leaving the MySQL port open to everyone invites brute-force attacks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_a_Database_in_MySQL_Workbench\"><\/span>Creating a Database in MySQL Workbench<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the connection. In the <strong>Navigator<\/strong> panel on the left, switch to the <strong>Schemas<\/strong> tab (in MySQL, &#8220;schema&#8221; and &#8220;database&#8221; mean the same thing).<\/li>\n<li>Right-click an empty area and choose <strong>Create Schema&#8230;<\/strong>, or click the database icon on the toolbar.<\/li>\n<li>Enter the database name. For Charset\/Collation choose <code>utf8mb4<\/code>, which fully supports all languages and emoji (the default collation in MySQL 8 is <code>utf8mb4_0900_ai_ci<\/code>).<\/li>\n<li>Click <strong>Apply<\/strong>. Workbench shows the SQL it will run; confirm with <strong>Apply<\/strong> again and <strong>Finish<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The command Workbench runs in the background looks like this, and you can type the same thing in the SQL editor yourself:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE SCHEMA `shop` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_Tables_and_Running_Queries\"><\/span>Creating Tables and Running Queries<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Expand your database in the Navigator, right-click <strong>Tables<\/strong> and choose <strong>Create Table&#8230;<\/strong>.<\/li>\n<li>Enter a table name and add columns. For the ID column, tick <strong>PK<\/strong> (primary key), <strong>NN<\/strong> (not null) and <strong>AI<\/strong> (auto increment).<\/li>\n<li>Click <strong>Apply<\/strong> to create it. Right-click the table and choose <strong>Select Rows<\/strong> to see the data in a grid and edit it directly.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">You can do the same in the SQL editor. After writing the query, press <strong>Ctrl+Shift+Enter<\/strong> to run everything, or <strong>Ctrl+Enter<\/strong> to run only the statement under the cursor (Cmd instead of Ctrl on macOS):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>USE shop;\n\nCREATE TABLE products (\n  id INT NOT NULL AUTO_INCREMENT,\n  name VARCHAR(150) NOT NULL,\n  price DECIMAL(10,2) NOT NULL,\n  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,\n  PRIMARY KEY (id)\n);\n\nINSERT INTO products (name, price) VALUES ('Keyboard', 750.00), ('Mouse', 320.50);\n\nSELECT * FROM products WHERE price &gt; 500;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Note: Workbench opens in <strong>Safe Updates<\/strong> mode by default and rejects UPDATE and DELETE queries whose WHERE clause doesn&#8217;t use a key column. This protects you from accidentally wiping a whole table; if you really need to, you can turn it off under Edit &gt; Preferences &gt; SQL Editor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_a_Database_from_the_Command_Line\"><\/span>Creating a Database from the Command Line<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On a server without a graphical interface, you do the same from the command line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p\nCREATE DATABASE shop CHARACTER SET utf8mb4;\nSHOW DATABASES;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Backing_Up_and_Restoring\"><\/span>Backing Up and Restoring<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Backup:<\/strong> in Server &gt; Data Export, select the database and use &#8220;Export to Self-Contained File&#8221; to save it as a single .sql file. Workbench uses <code>mysqldump<\/code> in the background for this.<\/li>\n<li><strong>Restore:<\/strong> in Server &gt; Data Import, choose &#8220;Import from Self-Contained File&#8221;, select the .sql file and set the target database.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"MySQL_Workbench_or_phpMyAdmin\"><\/span>MySQL Workbench or phpMyAdmin?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<div class=\"snc-table-wrap\"><table>\n<thead><tr><th><\/th><th>MySQL Workbench<\/th><th>phpMyAdmin<\/th><\/tr><\/thead>\n<tbody>\n<tr><td>Where it runs<\/td><td>Desktop application installed on your computer<\/td><td>Web interface running on the server (in the browser)<\/td><\/tr>\n<tr><td>Strength<\/td><td>Data modelling, advanced SQL editor, performance monitoring<\/td><td>No installation; comes ready in <a href=\"https:\/\/sunucun.com.tr\/hosting\/\" data-internallinksmanager029f6b8e52c=\"126\" title=\"Web bar\u0131nd\u0131rma paketlerini inceleyin\">hosting<\/a> panels (cPanel, Plesk)<\/td><\/tr>\n<tr><td>Remote connection<\/td><td>Directly through an SSH tunnel<\/td><td>Through the panel or the web<\/td><\/tr>\n<tr><td>Best for<\/td><td>Developers and database administrators<\/td><td>Shared hosting users<\/td><\/tr>\n<\/tbody><\/table><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Frequently_Asked_Questions\"><\/span>Frequently Asked Questions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Is_MySQL_Workbench_free\"><\/span>Is MySQL Workbench free?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, the Community Edition is free. The Commercial Edition adds features for MySQL Enterprise products.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Does_MySQL_Workbench_work_with_MariaDB\"><\/span>Does MySQL Workbench work with MariaDB?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Basic tasks (connecting, running queries, editing tables) usually work; but since Workbench is built for MySQL, you may see compatibility warnings on some administration screens.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Why_do_I_get_%E2%80%9CCannot_connect_to_database_server%E2%80%9D\"><\/span>Why do I get &#8220;Cannot connect to database server&#8221;?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The most common causes are: the MySQL service isn&#8217;t running, a wrong port or password, a firewall blocking 3306, or a user that may only connect from localhost. Connecting through an SSH tunnel to a remote server removes the last two problems.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL Workbench is a free tool that brings MySQL work, from creating databases to schema design and backups, into one interface. If you want to run your application&#8217;s database on your own server, you can install MySQL on a <a href=\"https:\/\/sunucun.com.tr\/en\/vds-server\">VDS server<\/a> and manage it securely with Workbench over an SSH tunnel.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Short answer: MySQL Workbench is Oracle&#8217;s official desktop tool for managing MySQL databases through a graphical interface. It brings writing and running SQL queries, creating databases and tables, designing schemas (data modelling), managing users and taking backups into one program. The Community Edition is free and runs on Windows, macOS and Linux. What Is MySQL&hellip;<\/p>\n","protected":false},"author":1,"featured_media":10085,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[1470],"tags":[],"class_list":["post-10087","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts\/10087","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/comments?post=10087"}],"version-history":[{"count":2,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts\/10087\/revisions"}],"predecessor-version":[{"id":19556,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts\/10087\/revisions\/19556"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/media\/10085"}],"wp:attachment":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/media?parent=10087"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/categories?post=10087"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/tags?post=10087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}