Loading...

Using MySQL Workbench with XAMPP

Please Note, it’s been pointed out that I need to make it clear that this covers version 5.2, the developer release, of MySQL Workbench.  The principles still apply to 5.1, but it’s a different process that I’ve not documented at all.  Apologies for any confusion.

This is a slight departure from our usual posts as it’s not about WordPress. However, if you’re developing with WordPress on a Windows PC there’s a good chance you’re using XAMPP as your platform.

I always liked the MySQL Administrator and MySQL Query Browser tools, but these have recently been deprecated and will not be updated any more. Instead, MySQL have released the MySQL Workbench, which is an all-in-one style DB tool that includes query browsing, database management and, interestingly, an entity relationship modeller. The latter is useful if you’re designing databases. In WordPress development you don’t do too much of that as it’s designed as a database light application. A shame, because a better DB structure would really extend its power and reduce the frankly vast amount of code that’s invoked. But that’s for another conversation!

Anyway, you’ll get the Workbench application and then find that it’s far harder to get going than the old tools. But don’t be put off, once you work out a few simple steps you’ll be off.

It’s worth noting that this is as new to me as it is to you – there may be better ways to do this, and I’ve made certain assumptions about how you use XAMPP. If you have any feedback, please comment below!

Create a New Server Instance

media_1263421672264.png

Start Workbench and you’ll be presented with a dashboard. Select New Server Instance.

Host machine is LocalHost

media_1263421812966.png

OS is Windows

media_1263421896152.png

You’ll need to check which version of MySQL you have installed – 5 or 5.1

Don’t Worry About the Error

media_1263421950071.png

XAMPP uses a .cnf file, not .ini No idea why, just the way they’ve compiled it, I guess. Remember, we’re not running MySQL from a standard build. Just click next.

Connection Values

media_1263422064481.png

Click and Open Connection Manager

Create a Connection Called localhost

media_1263422141981.png

Assuming you have the default XAMPP for development purposes then you can use the settings exactly as above. If you’ve assigned root a password you’ll need to completely the fields appropriately. Click Test Connection to make sure all is well. I like to use the Local Socket/Pipe, but you can use TCP/IP also.

The next step in the wizard will test the connection. All should be well and if not you’ve made a mistake.

Config File

media_1263422491464.png

This is the first point where you deviate from ‘normal’. If you click check path before setting it correctly, nothing will work. So, you need to know where XAMPP is installed. If it’s in the root of your T: drive as it is for our dev machines, then you need to enter the following path: T:\xampp\mysql\bin\my.cnf Change this according to where you placed XAMPP. If you can’t work this path out, maybe you should try a different vocation?

Click Next

Commands to Manage MySQL Server

media_1263422767403.png

This is where it gets a little more fun. The first two are quite easy to work out, but the third is quite different to the default. Maybe there’s a better command, but it was the best I could think of at the time.

As you can see, the commands are:

T:\xampp\mysql\bin\mysqld --defaults-file=T:\xampp\mysql\bin\my.cnf --standalone --console
T:\xampp\mysql\bin\mysqladmin --user=pma --password= shutdown
mysqladmin --user=pma --password= ping | findstr alive

You may also want to run the commands in the context of administrator in many cases, but I don’t run on my machine as administrator (I’m security conscious) and don’t have the need to run these as admin, so it’s not strictly necessary to tick the box. But for a development machine this isn’t a worry either way.

Name the Instance

media_1263422882590.png

Simples.

Finish off the wizard and you’ll have a new instance. As long as you start MySQL in advance with XAMPP, it will work as expected. Read the note below for more information on why.

A Note About Starting and Stopping

I have to admit that with the current settings I always start MySQL from the XAMPP control panel or shortcuts. If I stop MySQL from the Workbench it can stop it, but it will never notice that it’s stopped. This is less of an issue when you run MySQL as a service, and you can use the default commands given by the wizard, but running Apache and MySQL as a service can be a painful approach with XAMPP so few people bother. If I can find time to work out a slicker approach, or you can tell me of one, then I’ll update this guide.

I hope this guide has been useful. Thanks for reading!

Comments
  • Pedro Camarelles 7 / Jun / 2010 at 5:10 pm

    Xampp have two scripts for start and stop mysql, this option work fine in xampp 1.7.3

    c:\xampp\mysql_start.bat
    c:\xampp\mysql_stop.bat

    For check status i use c:\xampp\mysql\bin\mysqladmin -u root ping

    I hope it will help you

  • Az 9 / May / 2010 at 11:11 pm

    They appear to have changed the my.cnf to my.ini within the MySQL/bin/my.ini part of the install, so I used:

    Start: c:\xampp\mysql\bin\mysqld –defaults-file=c:\stuff\xampp\mysql\bin\my.ini –standalone –console
    Stop: c:\xampp\mysql\bin\mysqladmin -u root –password= shutdown
    Status: c:\xampp\mysql\bin\mysqladmin -u root –password= ping

    Seems to work ok, had a little trouble getting the apache service to restart, but it did in the end

  • Orihime 28 / Mar / 2010 at 3:08 am

    Nice guide. I believed they changed up the order of the dialogs when you setup, but it should be obvious to anyone following this guide. Also these are just minor things but I think they’re worth noting (for those who might have trouble):
    my mysql config is c:\xampp\mysql\bin\my.ini (rather than .cnf)

    Also if you’re running MySQL as a service then you’ll want to leave the defaults in the section labeled as commands to start/stop the mysql server (e.g. sc start mysql, sc stop mysql, sc query mysql | wba_filter(RUNNING)).

  • gavroche 24 / Mar / 2010 at 10:00 am

    I’m using version 5.1.18 OSS and XAMPP.
    Like papaman I can’t even find the “New Server Instance” option. There is nowere to be found. So I can’t connect to mysql instance.

  • Christophe 10 / Mar / 2010 at 5:46 pm

    … and to be able to work with admin’s tools (Accounts, Data Dump, .. ) you need to check “Enable named pipes” in Configuration | General

  • Christophe 10 / Mar / 2010 at 5:33 pm

    to overcome command problems, you can install MySQL as a service (via XAMPP control Panel ) and leave commands as proposed by the wizard

  • Cory Sessions 13 / Feb / 2010 at 9:45 pm

    Just to help clarify: the dashboard is in the 5.2 version. If you have the general release 5.1 version, there is not dashboard / “New Server Instance. Just download the development version and you’re good to go.

  • Richard Vidler 11 / Feb / 2010 at 6:32 pm

    Thanks for the instructions.

    Like everyone above, I found out the long way that you need the latest developer release and not the general release.

    Regarding the ‘Commands to Manage MySQL Server’ I found that the above had some typo’s with the commands (probably Word auto formating) and a minor simplification:

    Start: c:\xampp\mysql\bin\mysqld –defaults-file=c:\stuff\xampp\mysql\bin\my.cnf –standalone –console
    Stop: c:\xampp\mysql\bin\mysqladmin -u root –password=apple shutdown
    Status: c:\xampp\mysql\bin\mysqladmin -u root –password=apple ping

    and no, apple is not my password :)

    Hope this helps someone.

  • Klaus 9 / Feb / 2010 at 2:07 pm

    Thanks for this information, was very helpful.

  • Max 4 / Feb / 2010 at 6:05 pm

    I’m in the same boat as one of the other commenters–when I start Workbench, I see nothing like the “dashboard” you refer to in the first step, and no “new server instance” option. Instead I see a tab on the left called “MySQL Model”, and various smaller panes on the right, none of which look like the dashboard…

    • Interconnect IT 4 / Feb / 2010 at 8:51 pm

      Are you running the latest version? The older version didn’t have such a dashboard.

      • Max 4 / Feb / 2010 at 11:03 pm

        Ah, that must be it–I used the msi installer under the “general release” section, which is a considerably older version than what they have for the “developer release”. I’ll give it another try later, thanks!

  • emetib 1 / Feb / 2010 at 1:15 am

    crony

    my.cnf file

    http://dev.mysql.com/doc/refman/4.1/en/mysql-cluster-multi-config.html

    I installed MySQL Workbench 5.2 OSS here …
    C:\xampp\mysql\MySQL Workbench 5.2 OSS

    then created my 1st DB with phpmyadmin

    My Win 7 MySql setup did use my.cnf
    Here is the information it set up.
    Manage Server Instances –>System Profile
    Profile Template: Fedora Linux (MySql Package)

    Path to configuration file: /etc/my.cnf
    Section [name] from configuration file: mysqld

    MySql Management
    Start MySql: /etc/init.d/mysql start
    Stop MySql: /etc/init.d/mysql stop
    Check MySql Status: ps -C mysqld -o pid=

    box checked —Use sudo to execute

    I did find this odd … after doing a search of all files including hidden my search came up with NO file or directory of either name. [etc/my.cnf]

    maybe it has to do with DRBD which I am not familiar with using, mounting or configuring.

    http://dev.mysql.com/doc/refman/5.1/en/ha-drbd-install-mysql.html

  • alfonso llanes 31 / Jan / 2010 at 10:23 pm

    After I set up a localhost and to test connections WB asks for a password and I don’t know how to get around that. Can you help?

  • crony 31 / Jan / 2010 at 4:06 pm

    Yes I do ^^
    Xampp 1.6.3, perfectly running under eclipse environement…

  • crony 31 / Jan / 2010 at 9:53 am

    I forgot to tell, I’m testing with 5.2.15 OSS Beta revision 5053…Maybe it needs the stable version ?
    I also use MySql 5.0.45 community edition, I may choose between Mysql 5.0 x86 and x64 , Mysql 5.1 , and Mysql packages.
    Of course, using Mysql 5.0 x86 in my case.

    • Interconnect IT 31 / Jan / 2010 at 11:03 am

      It sounds to me like you’re not running XAMPP? In which case, you just need to follow the wizard on your own terms.

  • crony 31 / Jan / 2010 at 9:48 am

    Hello,
    Thanks for this, but I get an error too…
    Tested under winXP and Seven pro, same problem, server is not starting…
    I think I’ve been realy carrefull with config, so must missingbe something…

    Could it be possible to post the my.cnf properly formed ?( or sended by mail ? )
    I suspect “enable-named-pipe” parameters, or a problem with quotes at the moment…

    I would also like to see screenshots of an instance running. I’m particularly interested by the server status info (as the host is “Not Set” into mine…)
    If possible, screens of “general” and “networking” would help me understanding better.

    Thanks !

  • Sean 28 / Jan / 2010 at 5:57 am

    I am trying to set this up on XAMPP 1.7.3 and I am having an issue. This version of XAMPP seems to use a file called my.ini instead of my.cnf. I have the server instance created but when I try to start the server from the Startup area in Workbench it will not start. I have changed the start command to my.ini but it still will not work. The message I get is:

    2010-01-27 21:56:29 – Checking server status: Server is stopped.
    2010-01-27 21:56:29 – Trying to start server…
    2010-01-27 21:56:29 –
    2010-01-27 21:56:29 – Checking server status: Server is stopped.

    Is there an updated/alternate start command that needs to be used for this?

    • Interconnect IT 29 / Jan / 2010 at 9:20 am

      See the step called Config File? Tells you all you need to know…

      The whole point of a step by step guide is that you follow every step. If you do, all should be fine!

  • Mangia 26 / Jan / 2010 at 11:13 pm

    Yes it is buggy and sometimes unstable but it is usable.

    Also, one friend told me to download package without installer to avoid some problems I may have with installation process…

  • Mike 25 / Jan / 2010 at 1:53 pm

    The DB Designer Webpage download says that DB is now outdated and they suggest using Workbench – 5.2.14 is latest — so I guess that is the way to go …. thanks for the write up …looks very useful for my XAMPP arsenal

  • walther 23 / Jan / 2010 at 7:38 pm

    can´t start serverinstance
    (winxp, mysql running, workbench-installation ok)

    Input Password (dialog)
    `Enter Password to connect to MYSQL Server at as “.`
    strange?

    walther

  • PabloS 21 / Jan / 2010 at 6:32 pm

    This works great using the workbench for OS X 10.6, 5.2.x. Useful setup info is hard to find from MySQL, so great job! Thanks.

  • Outrage 21 / Jan / 2010 at 3:10 pm

    Unstable?
    Maybe I’ve been lucky but I’ve been using ‘workbench’ on XP, Vista and now Win7 for 2 years or more with very few problems.

    It does slow down a lot when working with many tables and admittedly I’ve only used the ‘designer’ and ‘sql export’ parts of the application to any extent, but I’ve been more than happy with the stability.

  • Vefhýsing 21 / Jan / 2010 at 2:43 pm

    I applied this to my WAMP installation, and it works like a charm. Thank you!

  • papaman 18 / Jan / 2010 at 10:41 pm

    I can’t even find the “New Server Instance” option

    • Interconnect IT 18 / Jan / 2010 at 11:37 pm

      It’s right there on the dashboard, to the right. Unless you have a tab already open, in which case, switch tabs or close them!

  • Brad 15 / Jan / 2010 at 8:19 pm

    I currently use DB Designer as well, and although it’s a great piece of software, I’m intrigued by Workbenches options and functionality. I see that someone has already mentioned how unstable it is (and I realize it’s still in beta) but I was wondering how well it truly works? how reliable is it? (I don’t save often and crashes kill my workflow )

    • Interconnect IT 16 / Jan / 2010 at 1:20 pm

      Unfortunately I’m not using it in anger just yet, so can’t really comment on its long term stability. Sorry.

  • Jeremy Jones 15 / Jan / 2010 at 2:21 pm

    I am surprised to see that you are able to use Workbench for a “real” project. It is so buggy and unstable. You are lucky!

    I love DBDesigner and still use it.

    • Interconnect IT 15 / Jan / 2010 at 4:21 pm

      Have to say, I’ve seen slicker! Apparently it works much better in a *nix system, so I’ll try it out on my Debian VM at some point.

      Of course, that won’t be XAMPP then :-)

1 2