How to install/configure MySQL Database



Similar documents
Setting Up Specify to use a Shared Workstation as a Database Server

MySQL Backup and Security. Best practices on how to run MySQL on Linux in a secure way Lenz Grimmer <lenz@mysql.com>

MySQL Quick Start Guide

Lenz Grimmer

MAMP 3 User Guide! March 2014 (c) appsolute GmbH!

HowTo. Planning table online

SIMIAN systems. Setting up a Sitellite development environment on Windows. Sitellite Content Management System

MySQL Quick Start Guide

Upgrading MySQL from 32-bit to 64-bit

LAMP Quickstart for Red Hat Enterprise Linux 4

Motorola Canopy Prizm Release 3.2 Server Setup Guide for Linux Platforms

Getting Started with Dynamic Web Sites

Installation Guide for contineo

CYAN SECURE WEB HOWTO. NTLM Authentication

How To Backup A Database On A Microsoft Powerpoint 3.5 (Mysqldump) On A Pcode (Mysql) On Your Pcode On A Macbook Or Macbook (Powerpoint) On

BrightStor ARCserve Backup for Linux

MySQL Backups: From strategy to Implementation

Getting Started with Attunity CloudBeam for Azure SQL Data Warehouse BYOL

Video Administration Backup and Restore Procedures

We begin with a number of definitions, and follow through to the conclusion of the installation.

Network Infrastructure Security Recommendations

Salem Radio Labs. APPLICATION NOTE 003 Configuring Rivendell Hot Standby Hosts on SuSE

CPE111 COMPUTER EXPLORATION

Database Security. Principle of Least Privilege. DBMS Security. IT420: Database Management and Organization. Database Security.

Installation Instructions

Installing Booked scheduler on CentOS 6.5

Part 3. MySQL DBA I Exam

INUVIKA OVD INSTALLING INUVIKA OVD ON RHEL 6

MySQL Administrator Copyright 2004 MySQL AB

Backup and Restore with 3 rd Party Applications

How to backup a remote MySQL server with ZRM over the Internet

Application note: Connecting the to a Database

Performing Administrative Tasks

Your complete guide to installing the Self-Service Portal and estore.

Installation of PHP, MariaDB, and Apache

Workflow Templates Library

FileMaker Server 14. FileMaker Server Help

Percona Server features for OpenStack and Trove Ops

How To Install Storegrid Server On Linux On A Microsoft Ubuntu 7.5 (Amd64) Or Ubuntu (Amd86) (Amd77) (Orchestra) (For Ubuntu) (Permanent) (Powerpoint

Build it with Drupal 8

VP-ASP Shopping Cart Quick Start (Free Version) Guide Version 6.50 March

FileMaker Server 13. FileMaker Server Help

Cloud Homework instructions for AWS default instance (Red Hat based)

How to Install Multicraft on a VPS or Dedicated Server (Ubuntu bit)

MySQL quick start guide

Installation Guide for FTMS and Node Manager 1.6.0

How To Install Amyshelf On Windows 2000 Or Later

Backup and Restore MySQL Databases

Installing Drupal 8 on Windows 7 with XAMPP. I am trying to install Drupal 8 on my Windows machine as a development system.

<Insert Picture Here> MySQL Security In A Cloudy World

Omnistar Recruiter Install User Guide (Codelock)

FileMaker Server 7. Administrator s Guide. For Windows and Mac OS

User Migration Tool. Note. Staging Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted Release 9.0(1) 1

How to Copy A SQL Database SQL Server Express (Making a History Company)

Installing and Running MOVES on Linux

ABS Manual Installation Guide

MarkLogic Server. Installation Guide for All Platforms. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

Database Administration with MySQL

IT360: Applied Database Systems. Database Security. Kroenke: Ch 9, pg PHP and MySQL: Ch 9, pg

VERSION 9.02 INSTALLATION GUIDE.

How To Run Anolicense Server On A Windows 7.5 (For Free) Or 8 (For Ubuntu) Or For Free (For Microsoft) (For Linux) (Or For Free) ( For

PHP+MYSQL, EASYPHP INSTALLATION GUIDE

Connect to an SSL-Enabled Microsoft SQL Server Database from PowerCenter on UNIX/Linux

How to Install SMTPSwith Mailer on Centos Server/VPS

The SkySQL Administration Console

FileMaker Server 8. Administrator s Guide

RemoteTM Web Server User Guide. Copyright Maxprograms

Installing and Configuring MySQL as StoreGrid Backend Database on Linux

DBA Tutorial Kai Voigt Senior MySQL Instructor Sun Microsystems Santa Clara, April 12, 2010

Bitrix Site Manager. VMBitrix Virtual Machine. Quick Start And Usage Guide

CEFNS Web Hosting a Guide for CS212

High Availability And Disaster Recovery

MassTransit 6.0 Enterprise Web Configuration for Macintosh OS 10.5 Server

Quick Start Guide. Cerberus FTP is distributed in Canada through C&C Software. Visit us today at

SafeGuard Enterprise upgrade guide. Product version: 7

Hardening MySQL. Maciej Dobrzański maciek at

Server Installation/Upgrade Guide

Kony MobileFabric. Sync Windows Installation Manual - WebSphere. On-Premises. Release 6.5. Document Relevance and Accuracy

Computer Science and Engineering Linux Cisco VPN Client Installation and Setup Guide

OpenEyes - Windows Server Setup. OpenEyes - Windows Server Setup

TSM for Windows Installation Instructions: Download the latest TSM Client Using the following link:

Lets Get Started In this tutorial, I will be migrating a Drupal CMS using FTP. The steps should be relatively similar for any other website.

CYCLOPE let s talk productivity

E-Commerce: Designing And Creating An Online Store

Tivoli Enterprise Monitoring Server "HOT" backup

Online shopping store

Enterprise Manager. Version 6.2. Installation Guide

SIMIAN systems. Setting up a Sitellite development environment on Mac OS X. Sitellite Content Management System

PHP/MySQL SQL Injections: Understanding MySQL Union Poisoining. Jason A. Medeiros :: CEO :: Presented for DC619 All Content Grayscale Research 2008

About This Document 3. About the Migration Process 4. Requirements and Prerequisites 5. Requirements... 5 Prerequisites... 5

Retailman POS Multi-location Setup

TAMS Analyzer 3 and Multi-User Projects. By Matthew Weinstein

How To Set Up Dataprotect

Amazon Web Services EC2 & S3

Virtual Machine daloradius Administrator Guide Version 0.9-9

DigiVault Online Backup Manager. Microsoft SQL Server Backup/Restore Guide

QUANTIFY INSTALLATION GUIDE

Transcription:

How to install/configure MySQL Database Nurcan Ozturk Abstract: I explain how I installed MySQL database on my machine heppc6.uta.edu and the web-interfece of MySQL (phpmyadmin, running on heppc1.uta.edu). Part I: MySQL database Introduction: MySQL is a relational database management system. It is a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL is open source software. It is provided by MySQL AB, a Swedish company owned and run by the MySQL founders and main developers. Since the core of the Magda-Manager for Grid-based Data is a MySQL database (the principal entities of Magda are implemented as MySQL tables), we wanted to install MySQL first to better understand its functionality and features. Requirements: MySQL needs at least Linux kernel versions 2.0 or higher. Where to learn more: The MySQL home page, http://www.mysql.com, provides the latest information about MySQL. The most recent version of the MySQL reference manual is available at http://www.mysql.com/documentation/index.html How to download/install MySQL database: 1. Go to the page http://www.mysql.com to see which platforms are supported and to decide which version and type of distribution to use. I describe here how to install MySQL 3.23 (stable release, recommended) on Linux. 2. Go to downloads and Linux downloads links. The recommended way to install MySQL on Linux is by using an RPM (RetHat Package Manager) file. Download both Server and Client programs rpm files. They will appear in your local directory as MySQL-3.23.43-1.i386.rpm MySQL-client-3.23.43-1.i386.rpm 3. To see all the files in an RPM package, run: shell> rpm qpl MySQL-3.23.43-1.i386.rpm To perform the installation, run (as root): shell> rpm i MySQL-3.23.43-1.i386.rpm MySQL-client-3.23.43-1.i386.rpm 4. The RPM places data in /var/lib/mysql. The RPM also creates the appropriate entries in /etc/rc.d to start the server automatically at boot time.

5. Once you install MySQL, the safe_mysqld script in /usr/bin directory starts the server with mysqld daemon and the mysql_install_db script in the same directory creates six tables (user, db, host, table_priv, colums_priv and func) in the mysql database which is controlled by the administrator. It is required because it stores all the information about user access privileges. The server should always be running. To check if the server is running: shell> /usr/bin/mysqladmin version shell> /usr/bin/mysqladmin variables 6. When you install MySQL database, a test database is automatically created that any user has the all privileges on it to try things out. Type: shell> mysql u test mysql> Since anything created in the test database can be removed by anyone else with access to it, it is always good idea to set up a root (administrator) password and open user accounts and grant privileges to users. To do this: shell> mysql u root p Enter password: skip by enter mysql> SET PASSWORD FOR root=password( new_password ); MySQL commands should be followed by a semicolon. You can connect to MySQL as root (administrator), even from another host. Type: shell> mysql u root h heppc6 p mysql> 7. Now you can create user accounts (as administrator): mysql> GRANT USAGE ON database_name.* TO utahep@localhost IDENTIFIED BY utahep ; and grant privileges to users: mysql> GRANT SELECT ON database_name.* TO utahep@localhost IDENTIFIED BY utahep ; This means that you created a user utahep who can connect with a password utahep from the localhost having only read privileges (means selective privileges) on the database which is database_name. If you want to grant full

privileges (create, drop, grant, select, insert, update, delete, index, alter, etc.) to the user on the database: mysql> GRANT ALL ON database_name.* TO utahep@localhost IDENTIFIED BY utahep ; If you want the user to connect from any other host you must issue GRANT statements for both utahep@localhost and utahep@ % ( % means any host name). Do not give normal users read access to the tables in the mysql database. Passwords are stored encrypted in the mysql.user table in this database such that any user can read them and potentially unencrypt the passwords. 8. The user utahep can now connect to MySQL from any host (no need for h heppc6 when connecting from localhost): shell> mysql u utahep h heppc6 p mysql> SHOW databases; mysql> USE database_name (no need for semicolon) create a table, and load data into the table in the database (which is database_name) that the user has privileges in to do so. It is very easy to create a table, you just write a text file table_name.txt containing one record per line, with values seperated by tabs and given in the order in which the columns will be listed in the table. I do not explain details here, since it is easier to do these things on the web, after you install the phpmyadmin program. See the instructions below. Part II: phpmyadmin Introduction: The phpmyadmin program (the web-interface of MySQL ) is used to handle the administration of MySQL over the WWW. PhpMyAdmin can administer a whole MySQL server (needs root user/administrator) but also a single database. To accomplish the latter you will need a properly configured MySQL user who has only read/write privileges on the desired database. Currently phpmyadmin can: create and drop databases create, copy, drop and alter tables delete, edit and add fields execute any SQL statement, including batch-queries manage keys on fields load text files into tables create and read dumps of tables

export and import data to CVS values communicate in more than 20 different languages Requriements: PHP3 or PHP4 (PHP > 3.0.8), MySQL, a web browser. (PHP is a tool that lets you create dynamic web pages. PHP-enabled web pages are treated just like regular HTML pages and you can create and edit them the same way you normally create regular HTML pages. For more information see http://php.net ) How to download/install phpmyadmin 2.2.1: 1. Go to the web page http://phpadmin.sourceforge.net. Download the appropriate file for your system (tar.bz2, tar.gz or zip files). Ours is phpmyadmin-2.2.1- php.tar.gz. 2. Untar the distribution : shell> tar xzvf phpmyadmin_2.2.1-php.tar.gz 3. Open the file config.inc.php in your favorite editor and change the values for host, user, and password to fit your environment. Read Documentation.txt file for the details. Make sure that the configuration file does not have any non-ascii characters (like EOF). Initially our server gave strange error messages because of these extra characters. 4. Open the file www.your-host.com/<your-install-dir>/index.php in your browser. PhpMyAdmin should now display a welcome screen and your database, or a login dialog if using advanced authentication. Ours is htpp://heppc1.uta.edu/kaushik/phpadmin/index.php 5. We use Advanced Authentication: phpmyadmin needs a standard_user that has only the SELECT privileges on the mysql.db and mysql.user tables. You must specify the details for the standard_user in the config.inc.php file. If you need help read the Documentation.txt file. To create this user, connect to MySQL: shell> mysql u root p mysql mysql> GRANT USAGE ON mysql.* TO standard_user @localhost IDENTIFIED BY password ; mysql>grant SELECT ON mysql.user TO standard_user @localhost; mysql> GRANT SELECT ON mysql.db TO standard_user @localhost;

Then each of the other users should be granted of a set of privileges on a set of particular databases but should not have any global privileges (administrator privileges: reload, shutdown, etc.). The Gridview program which displays the U.S. ATLAS Grid Testbed status, written by Kaushik De, is now filling the table TestBedArchive20 in the Gridview database every 30 minutes. Anybody can take a look using the same user/password currently set for the standard ATLAS web user/password on htpp://heppc1.uta.edu/kaushik/phpadmin/index.php. Part III: Replication in MySQL Introduction: It is always a good idea to replicate all your databases in the case of a machine failure on the primary MySQL server. A MySQL server installation on one machine can act as the master, while the second MySQL server on another machine can act as the slave. The master server keeps a binary log of updates and an index file to the binary logs to keep track of binary rotation. Another benefit of using replication is that you can get live backups of your system by doing a backup on a slave instead of doing it on a master. Requirements: The second MySQL server must be installed and running on another machine (it is heppc5.uta.edu in the following). How to set up replication: 1. Set up a special replication user on the master with only FILE privilege and permission to connect from all the slaves. shell> mysql u root p mysql mysql> GRANT FILE ON *.* TO repl@ % IDENTIFIED BY password ; You created a user named repl which can access your master from any host (this is ideally correct but it did not work out until I specified the name of master and the slave machine as well, so I repeated the above for repl@heppc6.uta.edu and repl@heppc5.uta.edu). 2. Shut down MySQL server on the master. shell> /usr/bin/mysqladmin u root p shutdown 3. Go to your data directory (/var/lib/mysql) where you store all the data files and create a snapshot of all the data on your master server. To do this: shell> tar cvf /tmp/mysql-snapshot.tar /var/lib/mysql

4. Create a my.cnf file on the master in the /etc directory and write the following into this file: [mysqld] log-bin=heppc6-bin.001 log-bin-index=heppc6-bin.index server-id=1 binlog-do-db= name of the database which master should log updates to the binary log binlog-ignore-db=name of the database which master should not log updates to the binary log You usually choose 1 as the server-id of the master and 2, 3,.. as that of the slaves. 5. Restart the server on master: shell> /usr/bin/safe_mysqld --log-bin This will create a binary log file (for instance, heppc6-bin.001 above) containing all SQL commands that update data and a binary index file (for instance, heppc6- bin.index above) to be able to know which different binary log files have been used in the /var/lib/mysql directory. Whenever you restart the server, mysqld will append an extension to the binary log filename and all used binary log files will be stored in the binary index file. 6. Create a my.cnf file on the slave in the /etc directory and write the following into this file: [mysqld] master-host=heppc6.uta.edu master-user=repl master-password=password master-port=3306 server-id=2 replicate-do-db= name of the database which you want to replicate replicate-ignore-db=name of the database which you do not want to replicate 7. Copy the snapshot data into your data directory (/var lib/mysql) on the slave and untar it: shell> tar xvf mysql-snapshot.tar 8. Restart the slave: shell> /usr/bin/safe_mysqld &

Now, the slave should connect to the master and catch up on any updates which happened since the snapshot was taken. Once the slave is replicating, you will find a file called master.info in the /var/lib/mysql directory on the slave. This file is used by the slave to keep track of how much of the master s binary log has processed. You can also check the status of the master and the slave in the mysql database: shell> mysql u root p mysql mysql> show master status; mysql> show slave status; Please read the MySQL reference manual for more information on replication options. Please let me know of any questions. Acknowledgements: Many thanks to Mark Sosebee, Kaushik De and Patrick Mcguigan for their help.