Starting to work with MySQL
Translation of the article: © Oleg Imansky,
(Link to the original article: http://dev.mysql.com/tech-resources/articles/mysql_intro.html)
MySQL AB is intended to give the reader an understanding of the basic concepts of database server MySQL. While future articles will delve into some of the more complex issues MySQL, including replication, ODBC and optimization, it would be prudent to start the first lesson, as the saying goes, first.
Therefore, the purpose of this article is to familiarize the reader with the basic functioning of MySQL. The list of what is covered is given below in the table of contents. You can go to any of them simply by clicking on its title.
Assumptions
It is assumed that the reader has successfully installed the database server MySQL. If MySQL is not installed, please take some time to review the information in the documentation section of MySQL, on installing. It is also assumed that the mysql database has been created (using mysql_install_db), and the MySQL database server was started with the script safe_mysqld. If not, take a few minutes to read the section “Post-Installation Setup and Testing” documentation MySQL. Learn more about mysql administration tool.
It also assumes that the reader has at least understands syntax SQL (Structured Query Language). For newcomers to the world of SQL, here are links to some very useful guidelines:
Philip Greenspun. “SQL for Web Nerds”
Mike Chapple’s Introduction to SQL
James Hoffman’s Introduction to SQL
Table of contents
So, you have installed MySQL. Now what?
Configuration file MySQL: my.cnf
MySQL grant tables
The connection to the MySQL server for the first time
Exit and re-connect to the MySQL Monitor
Gently with a password!
Selecting a Database
mysqladmin
Securing Database
GRANT command
REVOKE command
Database Backups
mysqldump
mysqlhotcopy
Conclusion
So, you have installed MySQL. Now what?
Installation manual carefully studied, the latest distribution downloaded, coffee brewed and drank and brewed again. Once again The familiar, configure, make and make install, to once again produce another beautifully compiled application. Nods were exchanged pats on the back, raised glasses of champagne. Yes, there is reason to holiday in the office today for the successful installation of the server MySQL.
You lounge in your chair, surrounded by colleagues hailing the newfound wisdom administrator. If they only knew the pain and anguish you, brain piercing question: “What now?”.
The purpose of this guide is to introduce new users to MySQL with several of the key aspects of this wonderful database server. Here give an introduction to the general server functionality, security, user administration, and their rights, working with databases, spreadsheets, and data backups. The reader will find much of this material easy to understand, but it should be borne in mind that these concepts lay the basis for effective work with the database server MySQL, in addition to the more complex aspects to be discussed in later tutorials. Therefore, the reader is advised not only to read the manual, but also to actually follow a series of steps described here, experimenting with his own installation of MySQL.
Configuration file MySQL: my.cnf
Most likely, the first thing he wants to do the administrator will correct setting configuration file MySQL. This file, my.cnf, stores default startup options for the server and clients. The way to optimize MySQL and proper configuration of this file can be long, as there memory buffer settings and other important parameters.
Interestingly, the scope of this file depends on its location. Settings are global for all servers MySQL, if they are stored in / etc / my.cnf. It will be global for a particular server MySQL, if located in the directory as its database (/ usr / local / mysql / data for a binary installation or / usr / local / var for the installation of the sources). Finally, its scope can be limited by the user if the file is located in the home directory of the user MySQL (~ /. My.cnf). Keep in mind that, even if the file is in my.cnf / etc / my.cnf (global to all MySQL servers on the machine), the server will continue to search for your file, and then a user configuration file. Final configuration parameters are the result of consistent application settings from / etc / my.cnf, mysql-data-dir/my.cnf and ~ /. My.cnf.
To help the administrator to properly create this file, MySQL developers have included in the distribution of four simple my.cnf file. Their names – my-huge.cnf.sh, my-large.cnf.sh, my-medium.cnf.sh and my-small.cnf.sh. Each of these recommended configuration settings in zavtsimosti the availability of various system resources.