DescriptionXAMPP is a software distribution which provides the Apache web server, MySQL database (actually MariaDB), Php and Perl (as command-line executables and Apache modules) all in one package. It is available for Windows, MAC and Linux systems. No configuration is necessary to integrate Php with MySQL. It is a great fit for this course and provides a relatively painless installation and way to manage the configuration changes. Also provided is PhpMyadmin which gives a GUI tool for managing your MySQL databases. I would highly recommend installing this for Windows or MAC. It doesn't exclude you from other competing software installations, it just gives an easy way to get going. For Ubuntu Linux systems, I still would recommend installing Apache/MySQL/Php/PhpMyadmin through Ubuntu packages. The XAMPP download site which I use is:
xampp-win32-7.2.1-0-VC15-installer.exeInstall in the usual way. It gives some notification messages for which you can just click OK. Close whatever installation brings upon completion. It installs into
C:\xamppAt some point the Windows Firewall may invoke notifications; just click Allow access and then Finish.
Run XAMPP Control Panel as administratorWhat you want to run is the XAMPP Control Panel found under XAMPP in the Start menu. Right-click and run this as administrator. Start both MySQL and Apache (unless you have an alternative Apache installation). I do not recommend messing with the Modules service column. When you start MySQL, you should see it running on port 3306. The Apache service gives you access to the Admin buttons next to the services. For Apache Admin, you get:
The MySQL clientsThe MySQL Client executables are located in the directory
C:\xampp\mysql\binThe most important one is the client program mysql.exe. From a command shell you can run:
> C:\xampp\mysql\bin\mysql (with or without the .exe extension) MariaDB[(none)]> MariaDB[(none)]> quitThis accesses the MariaDB database as the empty (or default) user with empty password. You can go into a specific database, say test, by doing:
mysql> use test MariaDB[(test)]>This test database already exists in the XAMPP MariaDB installation. It is accessible by the empty user. You can also go directly into the test database from the command line by:
> C:\xampp\mysql\bin\mysql test MariaDB[(test)]>You can also go in as an unknown user, e.g.:
> C:\xampp\mysql\bin\mysql -u guest testWhat's happening here is that the unknown user is getting replaced by the empty user. If you want to create other databases, or users, or alter passwords, you have to be the root user. To do so:
> C:\xampp\mysql\bin\mysql -u rootThe XAMPP installation also sets up the empty password to the root user.
Easy access to mysqlAlthough it is probably OK to use mysql as:
C:\xampp\mysql\bin\mysqlYou might want to make it usable simply as mysql. Here are two ways to do so.
The best solution is to put the directory into your PATH.
Start from Control Panel ⇾ System and Security and access:
System ⇾ Advanced System Settings ⇾ Advanced ⇾ Environment VariablesFind the Path variable in the System Variables. Select it and click Edit. It's best to prepend the new Path component with this addition:
C:\xampp\mysql\bin;The Home button on a Microsoft keyboard is a good way to get to the beginning of the Path expression. Alternatively, you can append the new Path component as:
;C:\xampp\mysql\binThen "OK" your way out.
Another way is to make a convenience batch executable in the directory
where your shell opens up into (it should be your home directory).
Go to your home
directory C:\Users\YOUR_LOGIN (or wherever your shell opens into)
and create the file
mysql.batMake sure file extensions are shown. Create an empty text file (New Text Document.txt) and rename the whole file to mysql.bat (Windows will complain!). Make the contents be:
@echo off C:\xampp\mysql\bin\mysql %*
Other mysql accessesRun the actual command client program through a command shell (cmd) by simply using mysql with various arguments. For example, try each of these (quit to leave MySQL):
> mysql as anonymous user > mysql -u root as root user > mysql -u root mysql as root user into mysql database > mysql test as anonymous user into test database > mysql -u guest test as guest user into test database > mysql mysql as anonymous user into mysql database (fails) > mysql -u guest mysql as guest user into mysql database (fails)
Using Cygwin MySQL Client executableIf, like me, you prefer the Cygwin shell, you can still get access to the XAMPP MySQL database through the Cygwin mysql client. Install the mysql client package in Cygwin, but don't install the mysql server package. Then you will be able to access the XAMPP (or any other) MySQL database with an added option like this:
$ mysql --protocol TCP ...To simplify this usage, create an alias by adding this line to your ~/.bashrc file:
alias mysql='mysql --protocol TCP'Open a new Cygwin shell and my can now use the mysql client directly.
xampp-osx-7.2.1-0r01-vm.dmgInstall in the usual way. The installation location is
/Applications/XAMPPand all executables are in
/Applications/XAMPP/binStarting /Applications/XAMPP will automatically start the Control Panel and you'll need to give your password so that the application can run as root and start services on protected ports. Use the Manage Servers tab in the Control Panel to start up MySQL (on port 3306) and/or Apache (on ports 80,443). Initially we only need MySQL. There doesn't appear to be any automatic way to invoke the "dashboard" and "phpmyadmin" URLs, but these are still available when both MySQL and Apache are running.
Access to the XAMPP Client ExecutablesThe most important executable at this point is the mysql client, which is the file:
/Applications/XAMPP/bin/mysqlYou should be able to execute this as is, but the best way is to execute it (as well as other XAMPP executables) is to augment the system PATH. To do so, edit the bash shell startup file:
~/.profileThe simplest way to edit it might be:
$ nano ~/.profileAdd the one line into the file to augument the PATH:
$ echo $PATH $ which mysqlYou should see the /Applications/XAMPP/bin component as the first component in the PATH variable.
Using the MySQL Client executable from another installationAny installed MySQL client can access the XAMPP MySQL database in the same way as in the Cygwin subsection of Windows:
$ mysql --protocol TCPIf you need to do it this way, do so using an alias as suggested above.