CC ICT-SUD Installation and configuration

Slides:



Advertisements
Similar presentations
Session 2Introduction to Database Technology Data Types and Table Creation.
Advertisements

MySQL Access Privilege System
Database Chapters.
MySQL. To start go to Login details: login: labuser password:macimd15 – There.
1 Dynamic DNS. 2 Module - Dynamic DNS ♦ Overview The domain names and IP addresses of hosts and the devices may change for many reasons. This module focuses.
Day 3 - Basics of MySQL What is MySQL What is MySQL How to make basic tables How to make basic tables Simple MySQL commands. Simple MySQL commands.
Cacti Workshop Tony Roman Agenda What is Cacti? The Origins of Cacti Large Installation Considerations Automation The Current.
Introduction to Structured Query Language (SQL)
Introduction to Structured Query Language (SQL)
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2010 All Rights Reserved. 1.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
1 CSE 480: Database Systems Lecture 9: SQL-DDL Reference: Read Chapter of the textbook.
Oracle Database Administration
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Oracle for Software Developers. What is a relational database? Data is represented as a set of two- dimensional tables. (rows and columns) One or more.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Lecture 9 – MYSQL and PHP (Part1) SFDV3011 – Advanced Web Development 1.
Database Technical Session By: Prof. Adarsh Patel.
Information Systems Today (©2006 Prentice Hall) MySQL 1CS3754 Class Note #8, Is an open-source relational database management system 2.Is fast and.
MySQL. Dept. of Computing Science, University of Aberdeen2 In this lecture you will learn The main subsystems in MySQL architecture The different storage.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
ITN Wake Tech1 ITN270 Advanced Internet Databases Lecture 15. General MySQL Administration Topics: –Securing a New MySQL Installation –MySQL Server.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
CSC 2720 Building Web Applications Database and SQL.
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2015, Fred McClurg, All Rights.
11 3 / 12 CHAPTER Databases MIS105 Lec15 Irfan Ahmed Ilyas.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
M1G Introduction to Database Development 2. Creating a Database.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
MySQL More… 1. More on SQL In MySQL, the Information Schema is the “Catalog” in the SQL standard SQL has three components: Data definition Data manipulation.
MySQL Gubbins Richard Sinclair HepSysMan – 11/05/2012.
Sql DDL queries CS 260 Database Systems.
Apache, MySQL and PHP Installation and Configuration Chapter 2 MySQL Installation and Configuration.
DATA BASE ADMINISTRING DATABASE SERVICES IN RED HAT LINUX.
Linux Operations and Administration
1 CS 430 Database Theory Winter 2005 Lecture 11: SQL DDL.
VIRTUAL HOSTING WITH PureFTPd And MYSQL (Quota And Bandwidth Management) BY Odoh Kenneth Emeka Sun Yu Patrick Appiah.
Relational Databases and MySQL. Relational Databases Relational databases model data by storing rows and columns in tables. The power of the relational.
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
Introduction to MySQL Ullman Chapter 4. Introduction MySQL most popular open-source database application Is commonly used with PHP We will learn basics.
Intro To Oracle :part 1 1.Save your Memory Usage & Performance. 2.Oracle Login ways. 3.Adding Database to DB Trees. 4.How to Create your own user(schema).
Unit-8 Introduction Of MySql. Types of table in PHP MySQL supports various of table types or storage engines to allow you to optimize your database. The.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
Introduction to MySQL  Working with MySQL and MySQL Workbench.
Software-Projekt 2008 Seminarvortrag“Short tutorial of MySql“ Wei Chen Verena Honsel.
SQL Basics Review Reviewing what we’ve learned so far…….
Slide Set #24: Database security SY306 Web and Databases for Cyber Operations.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Intro to MySQL.
3 A Guide to MySQL.
Fundamentals of DBMS Notes-1.
CS320 Web and Internet Programming SQL and MySQL
SQL and SQL*Plus Interaction
Postgres MySQL Bakeoff
Open Source Server Side Scripting Permissions & Users
Introduction To Database Systems
The Involuntary DBA Where there is Linux, you most likely will find MySQL or MariaDB. Like it or not, if you're working with Linux, you're a DBA.
DATABASE MANAGEMENT SYSTEM
Chapter 8 Working with Databases and MySQL
MySQL User Privileges: Grant
CS3220 Web and Internet Programming SQL and MySQL
Chapter # 7 Introduction to Structured Query Language (SQL) Part I.
Data.
MySQL Database System Installation Overview SQL summary
Chapter 11 Managing Databases with SQL Server 2000
CS3220 Web and Internet Programming SQL and MySQL
INTRODUCTION A Database system is basically a computer based record keeping system. The collection of data, usually referred to as the database, contains.
Presentation transcript:

CC ICT-SUD Installation and configuration MySQL CC ICT-SUD Installation and configuration

Package installation Some distribution split the client and server part into separate packages Distribution-depedent Arch Linux: # pacman -Sy mysql Ubuntu: $ sudo apt-get install mysql-server Fedora: # yum install mysql mysql-server

Run MySQL daemon General commands: Arch Linux: /etc/rc.d mysqld start cd /usr; /usr/bin/mysqld_safe & install support-files/mysql.server into your boot system Arch Linux: /etc/rc.d mysqld start Ubuntu: sudo invoke-rc.d mysql start Fedora: service mysqld start Or just reboot MySQL safe mode adds the following safety features: Restarts the server when an error occurs Logs runtime information to an error log file Datadir is /var/lib/mysql/DATABASE_NAME. You can make a database backup by copying these files. To get a consistent backup first stop the server or lock tables to backup (see MySQL manual for details).

Secure installation Run this helper script: # /usr/bin/mysql_secure_installation Set a MySQL root password (do not leave it empty!) Remove anonymous users Disallow root login remotely Remove test database and access to it Reload privilege tables now Manual: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h cvs password 'new-password' Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. The root account is used to maintain your MySQL users and databases. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Why two commands? If there is a second entry for root and your hostname is left with no password set, everybody from your host probably could gain full access.

Testing and access cd /usr/mysql-test ; perl mysql-test-run.pl Local access using MySQL's command line tool: $ mysql -p -u root For remote access on the TCP port 3306, edit /etc/mysql/my.cnf and comment out: skip-networking also enable access through TCP Wrapper in /etc/hosts.allow: mysqld: ALL : ALLOW mysqld-max: ALL : ALLOW The examples above are the simplest case, telling tcpd to allow connections from anywhere. You may wish to use a more-appropriate choice of permissible sources instead of 'ALL'. Just make sure that localhost and the IP address (numeric or DNS) of the interface by which you connect are specified.

Adding user accounts Example: a safe account for a certain local site For best security make one account per site or application with different passwords. E.g.: mysql> CREATE USER 'mysite'@'localhost' IDENTIFIED BY 'mypassword'; mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON mysitedb.* TO 'mysite'@'localhost'; mysql> FLUSH PRIVILEGES; Database privileges are stored in a relational database named “mysql”. To create accounts we could manipulate this db directly, but the preferred method is to use account-creation statements, such as CREATE USER or GRANT. First connect to the MySQL server as the MySQL root user as described before: $ mysql -uroot -p Use the '%' wildcard for the host part, if you want the user to be able to connect from any host. To make the new accounta available you must tell the server to reload the grant tables at the end using FLUSH PRIVILEGES. It is a good security practice to grant all and only the privileges that are strictly necessary. E.g. usually a web site won't need create and drop privileges. You can create the database from a schema dump by logging as root once for all: $ mysql -uroot -p <schema.sql For more examples and options see the MySQL manual.

Integer type hinter [0..255]: TINYINT UNSIGNED (1 byte) [-128..127]: TINYINT (1 byte) [0..65535]: SMALLINT UNSIGNED (2 bytes) [-32768..32767]: SMALLINT (2 bytes) [0..16777215]: MEDIUMINT UNSIGNED (3 bytes) [-8388608..8388607]: MEDIUMINT (3 bytes) [0..4294967295]: INT UNSIGNED (4 bytes) [-2147483648..2147483647]: INT (4 bytes) [0..18446744073709551615]: BIGINT UNSIGNED (8 bytes) [-9223372036854775808, +9223372036854775807]: BIGINT Select the best MySQL integer type to use based on range constraints. This minimizes the amount of storage required. Note that the integer range results from the two complements binary representation method.

String type hinter (1) Maxlen<=3: rtrim=NULL: storage=NULL: CHAR storage=fixed: CHAR storage=variable: VARCHAR storage=offpage: TINYTEXT rtrim=FALSE: storage=NULL: VARCHAR storage=fixed: N.A. rtrim=TRUE: storage=NULL: CHAR storage=fixed: CHAR storage=variable: VARCHAR storage=offpage: TINYTEXT Select between different binary and string data types based on these three attributes (NULL means "don't care"): maxlen: maximum number of characters or bytes (for binary data) to store rtrim: whether trailing spaces are removed or retained storage: where and how the column data are stored This decision tree will allow you to make a good choice. If you don't use it and you guess wrong MySQL will apply some silent column changes, unless strict SQL mode is enabled. N.A. = not available

String type hinter (2) Maxlen<=255: rtrim=NULL: storage=NULL: VARCHAR storage=fixed: CHAR storage=variable: VARCHAR storage=offpage: TINYTEXT rtrim=FALSE: storage=fixed: N.A. rtrim=TRUE: storage=NULL: VARCHAR storage=fixed: CHAR storage=variable: VARCHAR storage=offpage: TINYTEXT Select between different binary and string data types based on these three attributes (NULL means "don't care"): maxlen: maximum number of characters or bytes (for binary data) to store rtrim: whether trailing spaces are removed or retained storage: where and how the column data are stored This decision tree will allow you to make a good choice. If you don't use it and you guess wrong MySQL will apply some silent column changes, unless strict SQL mode is enabled.

String type hinter (3) Maxlen<=65535: rtrim=NULL: storage=NULL: VARCHAR storage=fixed: N.A. storage=variable: VARCHAR storage=offpage: TEXT rtrim=FALSE: rtrim=TRUE: storage=NULL: VARCHAR storage=fixed: N.A. storage=variable: VARCHAR storage=offpage: TEXT Select between different binary and string data types based on these three attributes (NULL means "don't care"): maxlen: maximum number of characters or bytes (for binary data) to store rtrim: whether trailing spaces are removed or retained storage: where and how the column data are stored This decision tree will allow you to make a good choice. If you don't use it and you guess wrong MySQL will apply some silent column changes, unless strict SQL mode is enabled.

String type hinter (4) Maxlen<=16777215: rtrim=NULL: storage=NULL: MEDIUMTEXT storage=fixed: N.A. storage=variable: N.A. storage=offpage: MEDIUMTEXT rtrim=FALSE: rtrim=TRUE: storage=NULL: MEDIUMTEXT storage=fixed: N.A. storage=variable: N.A. storage=offpage: MEDIUMTEXT Select between different binary and string data types based on these three attributes (NULL means "don't care"): maxlen: maximum number of characters or bytes (for binary data) to store rtrim: whether trailing spaces are removed or retained storage: where and how the column data are stored This decision tree will allow you to make a good choice. If you don't use it and you guess wrong MySQL will apply some silent column changes, unless strict SQL mode is enabled.

String type hinter (5) Maxlen<=4294967295: rtrim=NULL: storage=NULL: LONGTEXT storage=fixed: N.A. storage=variable: N.A. storage=offpage: LONGTEXT rtrim=FALSE: rtrim=TRUE: storage=NULL: LONGTEXT storage=fixed: N.A. storage=variable: N.A. storage=offpage: LONGTEXT Select between different binary and string data types based on these three attributes (NULL means "don't care"): maxlen: maximum number of characters or bytes (for binary data) to store rtrim: whether trailing spaces are removed or retained storage: where and how the column data are stored This decision tree will allow you to make a good choice. If you don't use it and you guess wrong MySQL will apply some silent column changes, unless strict SQL mode is enabled.

Some MySQL table types MyISAM (default): great performance, nontransactional, table-level locking, full-text search indexes, up to 256 TB InnoDB: transaction-safe, foreign keys, clustered indexes, row-level locking, up to 64 TB Memory: temporary, extremely fast, hash indexes by default How to choose: CREATE TABLE … (…) ENGINE=INNODB; Also called storage engines. MyISAM is used the most in Web, data warehousing and all other read heavy application enviroments /(many reads, some writes). Table-level locking: nobody can access any other record of the same table during an UPDATE. InnoDB (best for some reads, many writes cases where reability is required) is ACID compliant and has commit, rollback, and crash-recovery capabilities to protect user data. InnoDB stores user data in clustered indexes to reduce I/O for common queries based on primary keys. To maintain data integrity, InnoDB also supports FOREIGN KEY referential-integrity constraints. Row level locking means during an UPDATE, nobody can access that particular row, until the locking transaction issues a COMMIT. Memory should only be used for temporary tables: if MySQL crashes or it's shutted down you will lose all data stored in them!