Upload
others
View
6
Download
0
Embed Size (px)
Citation preview
Getting Started with MySQLLigaya TurmellePrincipal Technical Support Engineer, MySQL
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.2
Agenda
• Introduction
• Installation
• Layout and Configuration
• Securing the Server
• Interaction
• Backup
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.3
Intro to MySQL
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.4
Introduction
• World’s most popular open source database
• www.mysql.com
• dev.mysql.com
• bugs.mysql.com
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
MySQL Manual
• dev.mysql.com/doc
• Your new best friend
• Bookmark it!
5
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Getting Help
• Manual
• MySQL Support
• MySQL Forums
• Search the Web
• IRC on freenode - #mysql
6
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.7
Installation
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Installation Demo
8
http://dev.mysql.com/doc/refman/5.6/en/binary-installation.html
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Points of Interest from the Demo
• Download from dev.mysql.com
• Platforms can have multiple methods of installation
• For production level installation directions, see the manual
• Using --no-defaults and setting:
• --basedir --datadir -- console --socket
• Unsecured
9
http://dev.mysql.com/doc/refman/5.6/en/installing.htmlhttp://dev.mysql.com/doc/refman/5.6/en/binary-installation.htmlhttp://dev.mysql.com/doc/refman/5.6/en/mysqld-option-tables.html
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.10
Shutting Down
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Shutdown Demo
11
http://dev.mysql.com/doc/refman/5.6/en/automatic-start.htmlhttp://dev.mysql.com/doc/refman/5.6/en/mysqladmin.html
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.12
Layout and Config
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Binary Tar Installation
13
Directory Contentsbin client programs and mysqld serverdata log files, databasesinclude include (header) fileslib librariesscripts location of mysql_install_db share misc support filesmy.cnf option file
http://dev.mysql.com/doc/refman/5.6/en/binary-installation.html
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
The Option File
14
• my.cnf or my.ini (Windows)
• Customize for your needs
• basedir
• datadir
• logs
• server variables
http://dev.mysql.com/doc/refman/5.6/en/option-files.htmlhttp://dev.mysql.com/doc/refman/5.6/en/mysqld-option-tables.html
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Edit Option File Demo
15
http://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_basedirhttp://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_datadirhttp://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_sockethttp://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_log-error
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.16
Securing the Server
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Securing the Installation Demo
17
http://dev.mysql.com/doc/refman/5.6/en/default-privileges.htmlhttp://dev.mysql.com/doc/refman/5.6/en/mysql-secure-installation.html http://dev.mysql.com/doc/refman/5.6/en/set-password.htmlhttp://dev.mysql.com/doc/refman/5.6/en/mysqladmin.htmlhttp://dev.mysql.com/doc/refman/5.6/en/grant-table-structure.html
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.18
Interaction
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Command line client - mysql
• simple SQL client
• located in the bin directory
• interactive and non-interactive use
• includes help
• can be used in conjunction with other programs
19
http://dev.mysql.com/doc/refman/5.6/en/mysql.html
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
CLI Demo
20
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.21
Backup
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Backup, Backup, Backup
• Be paranoid!
• system crashes
• hardware failures
• Oops moments
22
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Little Bobby Tables
23
Image from xkcd.com http://xkcd.com/327/
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Making a backup
• Many ways to do
• mysqldump
• MySQL Enterprise Backup
• Snapshots
• Etc.
• Own talk
24
http://dev.mysql.com/doc/refman/5.6/en/backup-methods.html
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
mysqldump Utility
• Making the SQL file backup
• shell> mysqldump [arguments] > file.sql
shell> ./mysql/bin/mysqldump --all-databases > ~/dump.sql
• Reloading the SQL file backup
• used with the mysql clientshell> ./mysql/bin/mysql < ~/dump.sql
25
http://dev.mysql.com/doc/refman/5.6/en/mysqldump.htmlhttp://dev.mysql.com/doc/refman/5.6/en/mysqldump-sql-format.htmlhttp://dev.mysql.com/doc/refman/5.6/en/reloading-sql-format-dumps.html
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.26
Thank You
Tuesday, February 26, 2013
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.27
For additional practice, be sure to try the extra exercises.
Tuesday, February 26, 2013