Installing and configuring MySQL

For this course I will be using the open source MySQL Community Edition database. As mentioned in the previous lesson, the SQL language is universal and can be used with any popular RDBMS. If you are using another database system such as Oracle, SQL Server, PostgreSQL, or MariaDB (popular on CentOS and Fedora) you should be able to still follow along throughout this course. There are a few slight differences among the popular database systems the use of SQL, they will be mentioned in the lessons that apply.

MySQL has a graphical tool called Workbench that can be installed to get a visual look at the work you perform with SQL statements. However, once MySQL is installed we can use the command line client (Windows) or terminal (Mac & Linux) to perform all the tasks.

MySQL in Windows

There is an easy installation for installing the MySQL database in Windows called MySQL Installer. This will install the database system and the visual tool Workbench. The installer is 32bit (x86) but will install both the 32bit and 64bit versions of the database engine. The URL is https://dev.mysql.com/downloads/windows/installer/

Once downloaded, install using the default options (unless of course you have a need for something different). If you do not have Microsoft Office, Visual Studio, or Python already installed on your computer it will ignore those additions to the installation. They are not needed for this course.

You will need to setup a password for the root user account. You can also create a new user for the system if needed. Once installed search for the MySQL command line client. Type the root password and you are ready to begin creating a database. To exit type the command quit.

 

MySQL in Linux

The MySQL database should be available in your Linux distribution’s repository. You can also download the .deb or .rpm file from https://dev.mysql.com/downloads/repo/

If you are using Ubuntu 14.04 you can install from the repository using the following commands:

sudo apt-get install mysql-server-5.6

During the installation of MySQL you will be prompted for the password of the root user. Once installed you can log into the database from the terminal using the command:

mysql –u root –p

This will log you in as the root user and prompt you for the password. To exit type the quit command. Note, some Linux distributions will use mysql5 for logging in.

Questions