MySQL Manual.pdf

(3255 KB) Pobierz
281571691 UNPDF
MySQL Reference Manual
Copyright c 1997-2001 MySQL AB
Table of Contents
1 General Information About MySQL. . . . . . . . . 1
1.1 What Is MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 What Is MySQL AB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 About This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.1 Conventions Used in This Manual . . . . . . . . . . . . . . . . 5
1.4 History of MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5 Books About MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.6 The Main Features of MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.7 How Stable Is MySQL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.8 Year 2000 Compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.9 General SQL Information and Tutorials . . . . . . . . . . . . . . . . . . 18
1.10 Useful MySQL-related Links . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2 MySQL Mailing Lists . . . . . . . . . . . . . . . . . . . . . 29
2.1 The MySQL Mailing Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.2 Asking Questions or Reporting Bugs . . . . . . . . . . . . . . . . . . . . . 31
2.3 How to Report Bugs or Problems . . . . . . . . . . . . . . . . . . . . . . . . 31
2.4 Guidelines for Answering Question on the Mailing List . . . . 36
3 MySQL Licensing and Support . . . . . . . . . . . . 37
3.1 MySQL Licensing Policy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2 Copyrights Used by MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.2.1 Copyright Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.3 Example Licensing Situations . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.3.1 Selling Products that use MySQL . . . . . . . . . . . . . . . 39
3.3.2 ISP MySQL Services . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.3.3 Running a Web Server Using MySQL . . . . . . . . . . . 40
3.4 MySQL Licensing and Support Costs . . . . . . . . . . . . . . . . . . . . 40
3.4.1 Payment information . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.4.2 Contact Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.5 Types of Commercial Support . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.5.1 Basic E-mail Support . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.5.2 Extended E-mail Support . . . . . . . . . . . . . . . . . . . . . . 44
3.5.3 Login Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.5.4 Extended Login Support . . . . . . . . . . . . . . . . . . . . . . . 45
3.5.5 Telephone Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.5.6 Support for other table handlers . . . . . . . . . . . . . . . . 45
4 Installing MySQL . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.1 How to Get MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.2 Operating Systems Supported by MySQL . . . . . . . . . . . . . . . . 50
4.3 Which MySQL Version to Use . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.4 How and When Updates Are Released . . . . . . . . . . . . . . . . . . . 54
4.5 Installation Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.6 Installing a MySQL Binary Distribution . . . . . . . . . . . . . . . . . 55
4.6.1 Linux RPM Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.6.2 Building Client Programs . . . . . . . . . . . . . . . . . . . . . . 59
4.6.3 System-specic Issues . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.6.3.1 Linux Notes for Binary Distributions . . . 59
4.6.3.2 HP-UX Notes for Binary Distributions . . 60
4.7 Installing a MySQL Source Distribution . . . . . . . . . . . . . . . . . . 61
4.7.1 Quick Installation Overview . . . . . . . . . . . . . . . . . . . . 62
4.7.2 Applying Patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.7.3 Typical configure Options . . . . . . . . . . . . . . . . . . . . 65
4.8 Installing from the Development Source Tree . . . . . . . . . . . . . 67
4.9 Problems Compiling? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.10 MIT-pthreads Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.11 Perl Installation Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.11.1 Installing Perl on Unix . . . . . . . . . . . . . . . . . . . . . . . . 72
4.11.2 Installing ActiveState Perl on Windows . . . . . . . . 73
4.11.3 Installing the MySQL Perl Distribution on
Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.11.4 Problems Using the Perl DBI / DBD Interface . . . . . 74
4.12 System-specic Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.12.1 Solaris Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.12.2 Solaris 2.7/2.8 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . 77
4.12.3 Solaris x86 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.12.4 SunOS 4 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4.12.5 Linux Notes (All Linux Versions) . . . . . . . . . . . . . . 79
4.12.5.1 Linux-x86 Notes . . . . . . . . . . . . . . . . . . . . . 82
4.12.5.2 RedHat Version 5.0 Notes . . . . . . . . . . . . 83
4.12.5.3 RedHat Version 5.1 notes . . . . . . . . . . . . . 84
4.12.5.4 Linux-SPARC Notes . . . . . . . . . . . . . . . . . 84
4.12.5.5 Linux-Alpha Notes . . . . . . . . . . . . . . . . . . . 84
4.12.5.6 MkLinux Notes . . . . . . . . . . . . . . . . . . . . . . 85
4.12.5.7 Qube2 Linux Notes . . . . . . . . . . . . . . . . . . 85
4.12.5.8 Linux IA64 Notes . . . . . . . . . . . . . . . . . . . . 85
4.12.6 Alpha-DEC-UNIX Notes (Tru64) . . . . . . . . . . . . . . 85
4.12.7 Alpha-DEC-OSF1 Notes . . . . . . . . . . . . . . . . . . . . . . 87
4.12.8 SGI-Irix Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.12.9 FreeBSD Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.12.10 NetBSD notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.12.11 OpenBSD Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.12.11.1 OpenBSD 2.5 Notes . . . . . . . . . . . . . . . . . 90
4.12.11.2 OpenBSD 2.8 Notes . . . . . . . . . . . . . . . . . 90
4.12.12 BSD/OS Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.12.12.1 BSD/OS Version 2.x Notes . . . . . . . . . . 90
4.12.12.2 BSD/OS Version 3.x Notes . . . . . . . . . . 91
4.12.12.3 BSD/OS Version 4.x Notes . . . . . . . . . . 91
4.12.13 SCO Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4.12.14 SCO Unixware Version 7.0 Notes . . . . . . . . . . . . . 93
4.12.15 IBM-AIX notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.12.16 HP-UX Version 10.20 Notes . . . . . . . . . . . . . . . . . . 95
4.12.17 HP-UX Version 11.x Notes . . . . . . . . . . . . . . . . . . . 96
4.12.18 Mac OS X Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
4.12.18.1 Mac OS X Public beta . . . . . . . . . . . . . . 97
4.12.18.2 Mac OS X Server . . . . . . . . . . . . . . . . . . . 97
4.12.19 BeOS Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
4.13 Windows Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
4.13.1 Installing MySQL on Windows . . . . . . . . . . . . . . . . 98
4.13.2 Starting MySQL on Windows 95 or Windows 98
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.13.3 Starting MySQL on Windows NT or Windows 2000
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
4.13.4 Running MySQL on Windows . . . . . . . . . . . . . . . . 101
4.13.5 Connecting to a Remote MySQL from Windows
with SSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
4.13.6 Splitting Data Across Dierent Disks on Windows
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
4.13.7 Compiling MySQL Clients on Windows . . . . . . . 103
4.13.8 MySQL-Windows Compared to Unix MySQL . . 104
4.14 OS/2 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
4.15 MySQL Binaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.16 Post-installation Setup and Testing . . . . . . . . . . . . . . . . . . . . 108
4.16.1 Problems Running mysql_install_db . . . . . . . . 112
4.16.2 Problems Starting the MySQL Server . . . . . . . . . 113
4.16.3 Starting and Stopping MySQL Automatically . . 115
4.16.4 mysqld Command-line Options . . . . . . . . . . . . . . . 116
4.16.5 Option Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
4.17 Installing Many Servers on the Same Machine . . . . . . . . . . 123
4.18 Upgrading/Downgrading MySQL . . . . . . . . . . . . . . . . . . . . . . 124
4.18.1 Upgrading From Version 3.22 to Version 3.23 . . 125
4.18.2 Upgrading from Version 3.21 to Version 3.22 . . . 126
4.18.3 Upgrading from Version 3.20 to Version 3.21 . . . 127
4.18.4 Upgrading to Another Architecture . . . . . . . . . . . 128
Zgłoś jeśli naruszono regulamin