Mysql Reference Manual
Total Page:16
File Type:pdf, Size:1020Kb
MySQL Reference Manual Copyright °c 1997-2003 MySQL AB i Table of Contents 1 General Information ....................... 1 1.1 About This Manual ..................................... 2 1.1.1 Conventions Used in This Manual................ 2 1.2 What Is MySQL? ....................................... 3 1.2.1 History of MySQL .............................. 5 1.2.2 The Main Features of MySQL ................... 5 1.2.3 How Stable Is MySQL? ......................... 7 1.2.4 How Big Can MySQL Tables Be? ................ 8 1.2.5 Year 2000 Compliance .......................... 9 1.3 What Is MySQL AB? .................................. 11 1.3.1 The Business Model and Services of MySQL AB.. 11 1.3.1.1 Support .............................. 11 1.3.1.2 Training and Certification ............. 12 1.3.1.3 Consulting ........................... 12 1.3.1.4 Commercial Licenses .................. 13 1.3.1.5 Partnering............................ 13 1.3.1.6 Advertising ........................... 13 1.3.2 Contact Information ........................... 13 1.4 MySQL Support and Licensing .......................... 15 1.4.1 Support Offered by MySQL AB................. 15 1.4.2 Copyrights and Licenses Used by MySQL........ 15 1.4.3 MySQL Licenses............................... 16 1.4.3.1 Using the MySQL Software Under a Commercial License ....................... 16 1.4.3.2 Using the MySQL Software for Free Under GPL ..................................... 17 1.4.4 MySQL AB Logos and Trademarks ............. 18 1.4.4.1 The Original MySQL Logo............. 18 1.4.4.2 MySQL Logos that may be Used Without Written Permission ....................... 18 1.4.4.3 When do you need a Written Permission to use MySQL Logos? ....................... 18 1.4.4.4 MySQL AB Partnership Logos ......... 19 1.4.4.5 Using the word MySQL in Printed Text or Presentations ............................. 19 1.4.4.6 Using the word MySQL in Company and Product Names ........................... 19 1.5 MySQL 4.0 In A Nutshell............................... 19 1.5.1 Features Available From MySQL 4.0 ............ 19 1.5.2 Embedded MySQL Server ...................... 21 1.6 MySQL 4.1 In A Nutshell............................... 21 1.6.1 Stepwise Rollout............................... 21 1.6.2 Ready for Immediate Development Use.......... 21 ii 1.6.3 MySQL 5.0, The Next Development Release ..... 22 1.7 MySQL Information Sources ............................ 22 1.7.1 MySQL Mailing Lists .......................... 22 1.7.1.1 The MySQL Mailing Lists ............. 22 1.7.1.2 Asking Questions or Reporting Bugs.... 24 1.7.1.3 How to Report Bugs or Problems ...... 25 1.7.1.4 Guidelines for Answering Questions on the Mailing List .............................. 29 1.7.2 MySQL Community Support on IRC (Internet Relay Chat) ........................................... 29 1.8 How Standards-compatible Is MySQL?................... 30 1.8.1 What Standards Does MySQL Follow? .......... 30 1.8.2 Running MySQL in ANSI Mode ................ 31 1.8.3 MySQL Extensions to ANSI SQL92 ............. 31 1.8.4 MySQL Differences Compared to ANSI SQL92... 33 1.8.4.1 SubSELECTs .......................... 34 1.8.4.2 SELECT INTO TABLE ................... 35 1.8.4.3 Transactions and Atomic Operations ... 35 1.8.4.4 Stored Procedures and Triggers ........ 37 1.8.4.5 Foreign Keys ......................... 38 1.8.4.6 Views ................................ 39 1.8.4.7 ‘--’ as the Start of a Comment......... 39 1.8.5 Known Errors and Design Deficiencies in MySQL ................................................ 39 1.8.5.1 Errors in 3.23 Fixed in a Later MySQL Version................................... 40 1.8.5.2 Open Bugs / Design Deficiencies in MySQL ......................................... 40 1.9 MySQL and The Future (The TODO) ................... 43 1.9.1 Things That Should be in 4.0................... 44 1.9.2 Things That Should be in 4.1................... 44 1.9.3 Things That Should be in 5.0................... 44 1.9.4 Things That Must be Done in the Near Future... 45 1.9.5 Things That Have to be Done Sometime ........ 48 1.9.6 Things We Don’t Plan To Do................... 49 1.10 How MySQL Compares to Other Databases ............. 49 1.10.1 How MySQL Compares to mSQL ............... 49 1.10.1.1 How to Convert mSQL Tools for MySQL ......................................... 52 1.10.1.2 How mSQL and MySQL Client/Server Communications Protocols Differ........... 52 1.10.1.3 How mSQL 2.0 SQL Syntax Differs from MySQL .................................. 53 1.10.2 How MySQL Compares to PostgreSQL ......... 55 1.10.2.1 MySQL and PostgreSQL development strategies................................. 56 1.10.2.2 Featurewise Comparison of MySQL and PostgreSQL .............................. 56 iii 1.10.2.3 Benchmarking MySQL and PostgreSQL ......................................... 60 2 MySQL Installation ....................... 64 2.1 Quick Standard Installation of MySQL................... 64 2.1.1 Installing MySQL on Linux..................... 64 2.1.2 Installing MySQL on Windows ................. 65 2.1.2.1 Installing the Binaries ................. 66 2.1.2.2 Preparing the Windows MySQL Environment ............................. 66 2.1.2.3 Starting the Server for the First Time .. 68 2.1.3 Installing MySQL on Mac OS X ................ 68 2.2 General Installation Issues .............................. 70 2.2.1 How to Get MySQL ........................... 70 2.2.2 Verifying Package Integrity Using MD5 Checksums or GnuPG ........................................... 70 2.2.3 Operating Systems Supported by MySQL ....... 73 2.2.4 Which MySQL Version to Use .................. 75 2.2.5 Installation Layouts............................ 77 2.2.6 How and When Updates Are Released........... 78 2.2.7 MySQL Binaries Compiled by MySQL AB....... 78 2.2.8 Installing a MySQL Binary Distribution ......... 82 2.3 Installing a MySQL Source Distribution.................. 85 2.3.1 Quick Installation Overview .................... 86 2.3.2 Applying Patches .............................. 88 2.3.3 Typical configure Options .................... 88 2.3.4 Installing from the Development Source Tree..... 91 2.3.5 Problems Compiling MySQL? .................. 93 2.3.6 MIT-pthreads Notes ........................... 95 2.3.7 Windows Source Distribution ................... 96 2.4 Post-installation Setup and Testing ...................... 97 2.4.1 Problems Running mysql_install_db ......... 101 2.4.2 Problems Starting the MySQL Server .......... 102 2.4.3 Starting and Stopping MySQL Automatically... 104 2.5 Upgrading/Downgrading MySQL....................... 105 2.5.1 Upgrading From Version 4.0 to Version 4.1 ..... 106 2.5.2 Upgrading From Version 3.23 to Version 4.0 .... 106 2.5.3 Upgrading From Version 3.22 to Version 3.23 ... 109 2.5.4 Upgrading from Version 3.21 to Version 3.22 .... 110 2.5.5 Upgrading from Version 3.20 to Version 3.21 .... 111 2.5.6 Upgrading to Another Architecture ............ 112 2.6 Operating System Specific Notes ....................... 113 2.6.1 Linux Notes (All Linux Versions) .............. 113 2.6.1.1 Linux Notes for Binary Distributions .. 116 2.6.1.2 Linux x86 Notes ..................... 118 2.6.1.3 Linux SPARC Notes ................. 118 2.6.1.4 Linux Alpha Notes ................... 119 2.6.1.5 Linux PowerPC Notes ................ 119 iv 2.6.1.6 Linux MIPS Notes ................... 119 2.6.1.7 Linux IA64 Notes .................... 120 2.6.2 Windows Notes............................... 120 2.6.2.1 Starting MySQL on Windows 95, 98 or Me ........................................ 120 2.6.2.2 Starting MySQL on Windows NT, 2000 or XP ..................................... 121 2.6.2.3 Running MySQL on Windows......... 122 2.6.2.4 Connecting to a Remote MySQL from Windows with SSH ...................... 123 2.6.2.5 Splitting Data Across Different Disks on Windows ................................ 124 2.6.2.6 Compiling MySQL Clients on Windows ........................................ 124 2.6.2.7 MySQL-Windows Compared to Unix MySQL ................................. 125 2.6.3 Solaris Notes ................................. 127 2.6.3.1 Solaris 2.7/2.8 Notes ................. 129 2.6.3.2 Solaris x86 Notes .................... 130 2.6.4 BSD Notes ................................... 131 2.6.4.1 FreeBSD Notes ...................... 131 2.6.4.2 NetBSD notes ....................... 132 2.6.4.3 OpenBSD 2.5 Notes .................. 132 2.6.4.4 OpenBSD 2.8 Notes .................. 132 2.6.4.5 BSD/OS Version 2.x Notes ........... 132 2.6.4.6 BSD/OS Version 3.x Notes ........... 133 2.6.4.7 BSD/OS Version 4.x Notes ........... 133 2.6.5 Mac OS X Notes ............................. 134 2.6.5.1 Mac OS X 10.x ...................... 134 2.6.5.2 Mac OS X Server 1.2 (Rhapsody) ..... 134 2.6.6 Other Unix Notes ............................ 134 2.6.6.1 HP-UX Notes for Binary Distributions ........................................ 134 2.6.6.2 HP-UX Version 10.20 Notes........... 135 2.6.6.3 HP-UX Version 11.x Notes............ 136 2.6.6.4 IBM-AIX notes ...................... 137 2.6.6.5 SunOS 4 Notes ...................... 138 2.6.6.6 Alpha-DEC-UNIX Notes (Tru64)...... 139 2.6.6.7 Alpha-DEC-OSF/1 Notes............. 140 2.6.6.8 SGI Irix Notes ....................... 141 2.6.6.9 Caldera (SCO) Notes................. 142 2.6.6.10 Caldera (SCO) Unixware Version 7.0 Notes ................................... 144 2.6.7 OS/2 Notes .................................. 144 2.6.8 BeOS Notes .................................. 145 2.6.9 Novell NetWare Notes ........................ 145 2.7 Perl