Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database server Campus-Booster ID : ****** www.supinfo.com Copyright © SUPINFO. All rights reserved MySQL.

Similar presentations


Presentation on theme: "Database server Campus-Booster ID : ****** www.supinfo.com Copyright © SUPINFO. All rights reserved MySQL."— Presentation transcript:

1 Database server Campus-Booster ID : ****** www.supinfo.com Copyright © SUPINFO. All rights reserved MySQL

2 Your trainer… Title: **Enter title or job role. Accomplishments: **What makes the presenter qualified to present this course. Education: **List degrees if important. Publications: **Writings by the presenter on the subject of the course or presentation. Contact: **Campus-Booster ID: presenter@supinfo.com Presenter’s Name MySQL

3 Course objectives Install Mysql. Server installation and configuration Use Mysql Replicate Mysql By completing this course, you will: MySQL

4 Course topics Introduction. MySQL History and concepts Configuration. client-server installation and configuration MySQL Usage. Course’s plan: MySQL

5 Introduction What’s MySQL ? MySQL

6 Preview History What’s MySQL Comparison Introduction

7 History First version : May,23 1995 Created by Michaël Widenius in Sweden Under GPL License with the version 3 In June 2000 Redeem by Sun Microsystems FOSS (Free and Open Source Software)‏ Commercial License Current version 5.1 Introduction

8 What’s MySQL MySQL is a RDBMS MySQL is a relational SQL database server OpenSource Software Multi OS : Linux Mac OS X Windows The most used DBMS all over the world Lightweight resources needed Cluster supported with the Version 4.1 Introduction

9 Comparaison The different versions of MySQL FeaturesMySQL 3.x No MySQL 4.0 Partial No MySQL 5.x Yes Subquery View Foreign KeysTriggers Constraints Introduction

10 Stop and think Introduction Do you have any questions?

11 Configuration Configuration of MySQLv5 MySQL

12 Preview Installation Configuration

13 Installation Installation with binary Recommended Download it : http://dev.mysql.com/downloads/ Installation with packages tools Needs to update the sources list Configuration

14 Installation Launch the server Use the automatic rc script Manual Launch : mysqld_safe usage comparative to mysqld : In case of problems reboot the server logging Give parameters to mysqld Configuration # /etc/init.d/mysqld start # /usr/bin/mysqld_safe start

15 Configuration Only one configuration file my.cnf For the server like for the client Based on a section structure Example of a configuration file : Configuration

16 Stop and think Configuration Do you have any questions?

17 Basic usage Basic usage of MySQL 5 MySQL

18 Preview Define an admin password Manage users Create/Delete a database Administration tools Basic usage

19 Define a root password By default the root password is empty Adding a password for the root account : or with mysqladmin command: An user exists once he has rights on a table # mysql -u root mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES; # mysql -u root mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES; Basic usage # mysqladmin -u root password

20 Listing existing users Basic usage A simple SQL statement : mysql> SELECT user,password,host FROM mysql.user; +---------+------------+-------------------+ | user | password | host | +---------+------------+-------------------+ | root | *A4E990E4… | localhost | | root | | Arbalest | | supinfo | *06CDF16C… | linux.supinfo.com | +---------+------------+-------------------+ 3 rows in set (0.01 sec)‏ mysql> SELECT user,password,host FROM mysql.user; +---------+------------+-------------------+ | user | password | host | +---------+------------+-------------------+ | root | *A4E990E4… | localhost | | root | | Arbalest | | supinfo | *06CDF16C… | linux.supinfo.com | +---------+------------+-------------------+ 3 rows in set (0.01 sec)‏

21 Create a database With mysqladmin Within MySQL client (SQL statement) # mysqladmin -p create mandriva mysql> CREATE DATABASE mandriva; Basic usage

22 Delete a database With mysqladmin Within MySQL client (SQL statement) Basic usage # mysqladmin -p drop mandriva mysql> DROP DATABASE mandriva;

23 Note Every command in basic usage is a SQL statement Basic usage

24 Administration tools Many MySQL tools are available: Installed with the server  mysql_install_db, mysql_find_rows, mysql_manager Non-free Clients  MySQL explorer, MySQL tracer Web Clients  PHPMyAdmin Basic usage

25 Stop and think Basic usage Do you have any questions?

26 Replication Setting up replication with MySQL MySQL

27 Preview What’s a replication? Setting up the master Setting up the slave(s)‏ Replication

28 Overview Setting up a replication Characteristics:  Unidirectional: Master -> Slave(s)‏  Binary log file usage Element of concern: The database What for? Fault tolerance Load balancing Replication

29 Replication account Replication user creation Rights attribution  replication slave Command used  GRANT statement Replication mysql> GRANT replication slave,replication client, super,reload ON *.* TO 'user'@'%' IDENTIFIED BY 'password' mysql> GRANT replication slave,replication client, super,reload ON *.* TO 'user'@'%' IDENTIFIED BY 'password'

30 Setting up the master Configuration of the master and database archiving Configuration  Adding options log-bin : Active the creation of binary log server-id : master’s unique number Command used for manual replication Replication # cd /var/lib/mysql # tar -cvjf mysql-database.tar.bz2 test

31 Setting up the slave(s)‏ Slave configuration Configuration  Adding options master-host : master server name master-user : replication account username master-password : replication account password master-port : server port server-id : slave’s unique number (mandatory)‏ Replication

32 Setting up the slave(s)‏ Activate the replication (after creating the same database on both servers)‏ Command : Replication Mysql > LOAD DATA FROM MASTER;

33 Setting up the slave(s)‏ Uncompressing the database Command for uncompressing Replication # cd /var/lib/mysql # tar -xvjf mysql-database.tar.bz2 # cd /var/lib/mysql # tar -xvjf mysql-database.tar.bz2

34 Note The replication is done, you just have to restart the master and the slave(s) ‏ Replication

35 Stop and think Replication Do you have any questions?

36 MySQL setup Basic usage MySQLReplication Course summary Installation of MySQL MySQL

37 For more CoursesPublicationsWeb sites Introduction to databases If you want to go into these subjects more deeply… www.labo-linux.com www.dunod.fr MySQL

38 Congratulations You have successfully completed the SUPINFO course module MySQL

39 The end MySQL


Download ppt "Database server Campus-Booster ID : ****** www.supinfo.com Copyright © SUPINFO. All rights reserved MySQL."

Similar presentations


Ads by Google