From the course: Installing Apache, MySQL, and PHP

Use MySQL Workbench on Windows

From the course: Installing Apache, MySQL, and PHP

Start my 1-month free trial

Use MySQL Workbench on Windows

- [Instructor] In order to work with MySQL you'll need a client application. And when you installed MySQL on Windows you had the option of installing MySQL Workbench, a graphical user interface that's provided for free by Oracle. If you installed it you can start MySQL Workbench from the Start menu. When it first opens you should see a reference to your local instance of the MySQL server. Click on that, and then, when prompted, enter the admin password that you created when you installed the server. When you come to the starting screen the layout may differ depending on the history of the use of this product on your computer. But over here you should see a navigator window and then, down at the bottom, two tabs labeled Administration and Schemas. The schemas that you see already there are system-level databases. Those are databases you usually don't need to work with. In order to create your own database go to the toolbar and click on this icon to create a new schema in the connected server. I'm going to name my new schema contacts, and then down here I'll click Apply. I see the SQL statement that's going to be executed and when I click Apply the database is created. And then, in the SCHEMAS list over here, I should see the schema shown. Now, I'll open that schema list by clicking on the tree icon and I'll see that there aren't any tables. I'll right-click and create a table, and I'll name this people. And I can immediately start adding column names. I'll create a primary key column that I'll name personId and when I Tab out of that, a couple of these columns get checked automatically. If you don't see all of these columns just drag this out here so you can see everything and then click on the check box under AI, which stands for auto increment. That means that each time you create a new row in this table you'll be assigning the next available integer number. Now I'll create another couple of columns. This one will be called firstname, and I'll accept the default datatype of VARCHAR45. That means a string of up to 45 characters. Then I'll do the same thing to create a last name column and now my table has three columns. I'll click Apply and I'll see the SQL statement that's about to be executed to create the table, and I'll click Apply again, and the table has been created. In the SCHEMAS list I can now open the Tables list, I'll see the new table, I'll open that, and then I'll click on this table icon to see the table's data. There isn't anything there yet so I'm going to double-click under first name and type Joe and then I'll type Smith in the last name then I'll click Apply and I see an INSERT statement. I'll click the Apply button and Finish, and now the data is in the table. If you want to remove the table, right-click on it and choose Drop Table and if you want to remove the entire schema right-click on that and choose Drop Schema. MySQL Workbench gives you complete access to your MySQL database, in addition to these abilities to create and modify data structure and add data, there are also tools for monitoring the health of your server. Look under the Administration tab on the PERFORMANCE link to see some of that information. Whether you use MySQL Workbench or another interface, you do need a client application to work with your server and MySQL Workbench is free, and easy to use.

Contents