Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> MySQL

การติดตั้ง MySQL บน Unix/Linux ด้วย Generic Binaries

Oracle 提供 binary distributions: generic binary distributions (compressed tar files .tar.xz) สำหรับหลาย platforms และ platform-specific package formats

ชื่อไฟล์: 'mysql-VERSION-OS.tar.xz' (VERSION = number, OS = operating system type)

Debug versions: mysqld-debug หาก compile เองจาก source ใช้ appropriate configuration options

คำสั่งติดตั้งและใช้งาน Binary Distribution:

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar xvf /path/to/mysql-VERSION-OS.tar.xz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql
shell> bin/mysql_ssl_rsa_setup
shell> bin/mysqld_safe --user=mysql &
# Optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

สมมติฐาน: User มี root (administrator) access

mysql-files directory: ใช้เป็นค่า secure_file_priv system variable จำกัด import/export operations ใน directory เฉพาะ (ดู Section 5.1.8)

สรุปขั้นตอน:

  1. Create mysql User and Group: groupadd mysql, useradd -r -g mysql -s /bin/false mysql
  2. Obtain and unpack distribution: cd /usr/local, tar xvf /path/to/mysql-VERSION-OS.tar.xz (tar สร้าง directory mysql-VERSION-OS)
  3. Alternative extract: xz -dc /path/to/mysql-VERSION-OS.tar.xz | tar x
  4. Create symbolic link: ln -s full-path-to-mysql-VERSION-OS mysql (เข้าถึง path ง่ายขึ้น /usr/local/mysql)
  5. Add to PATH: export PATH=$PATH:/usr/local/mysql/bin