Install and upgrade MySQL 5.5.12

Source: Internet
Author: User

InnoDB in mysql 5.5 serves as the default database storage engine, and after the mysql-5.1 upgrades mysql to the mysql-5.5, the following programs need to recompile and install the upgrade:
PHP 5.3.6
Cacti spine
Pureftp

Install
Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.12-linux2.6-x86_64.tar.gz/from/http://mysql.ntu.edu.tw/

Tar-C/usr/local-xzf mysql-5.5.12-linux2.6-x86_64.tar.gz
Cd/usr/local
Ln-s mysql-5.5.12-linux2.6-x86_64/mysql

Cd/usr/local/mysql
Mkdir-p/usr/local/mysql/etc/
Cp support-files/my-huge.cnf etc/my. cnf

Sed-I's/skip-locking/skip-external-locking/'my. cnf
Sed-I's/default-character-set/character-set-server/'my. cnf
Sed-I's/log_slow_queries/slow_query_log/'my. cnf

Modify server-id = 1 to the last digit of the server IP address, or another value:
Cd/usr/local/mysql/etc/
Vim my. cnf
# Max_allowed_packet = 1 M
Servers-id = 8108

Max_allowed_packet = 64 M
Max_connections = 800
Character-set-server = utf8
Expire_logs_days = 60
Binlog_format = mixed
Log-bin = mysql-bin
# Read_only = 1
# Slave-skip-errors = route 1053

Innodb_log_files_in_group = 2
# Default_table_type = INNODB // unknown variable
Innodb_data_home_dir =/opt/data/mysql/
Innodb_data_file_path = ibdata1: 2000 M; ibdata2: 2000 M; ibdata3: 20 M: autoextend
Innodb_log_group_home_dir =/opt/data/mysql/

#4G RAM
Innodb_buffer_pool_size = 1G
Innodb_log_file_size = 256 M
Innodb_log_buffer_size = 8 M
Innodb_flush_log_at_trx_commit = 0
Innodb_thread_concurrency = 8
Innodb_flush_method = O_DIRECT

# Perform
Tmp_table_size = 512 M
Max_heap_table_size = 128 M

Slow_query_log
# Log-queries-not-using-indexes
# Log-slow-admin-statements
# Slow_query_log_file = mysql-slow.log
Long_query_time = 1
Log-error = mysqld. log

[Mysqld_safe]
Log-error =/var/log/mysqld. log
Pid-file =/var/run/mysqld. pid

Add database users
/Usr/sbin/groupadd-g 502 mysql
/Usr/sbin/useradd-u 502-g mysql

Mkdir-p/opt/data/mysql/
Chown mysql. mysql/opt/data/mysql/

Cd/usr/local/mysql/
Scripts/mysql_install_db-user = mysql
Chown-R root.
Chown-R mysql data
Chgrp-R mysql.
# Chmod-R u + rw data
Cd/opt/data/mysql/
Chown mysql. mysql/opt/data/mysql/

Cd/usr/local/mysql/
Cp support-files/mysql. server/etc/rc. d/init. d/mysqld
Chmod + x/etc/rc. d/init. d/mysqld

/Etc/rc. d/init. d/mysqld restart

#/Sbin/chkconfig-level 345 mysqld on
#/Sbin/chkconfig-del mysqld
/Sbin/chkconfig-add mysqld
/Sbin/chkconfig-list mysqld

Echo "/usr/local/mysql/lib">/etc/ld. so. conf
Cat/etc/ld. so. conf
Ldconfig

Mkdir-p/var/lib/mysql/
Ln-s/tmp/mysql. sock/var/lib/mysql. sock

#/Usr/local/mysql/bin/mysqld_safe &
Mkdir-p/var/run/mysqld/
Chown mysql/var/run/mysqld/

# Add mysql to the path
Echo pathmunge/usr/local/mysql/bin after>/etc/profile. d/mysql. sh

# Run the following command to ensure that mysql is in the path environment variable.
./Etc/profile

Upgrade mysql5.1 to mysql5.5
Mysql_upgrade contains the following three commands:
# Mysqlcheck-check-upgrade-all-databases-auto-repair
# Mysql_fix_privilege_tables
# Mysqlcheck-all-databases-check-upgrade-fix-db-names-fix-table-names
During each upgrade, we recommend that you run the mysql_upgrade command to check whether the database is compatible with the new version and fix the issue simultaneously. Use the mysql_fix_privilege_tables command to upgrade the permission table.
/Usr/local/mysql/bin/mysql_upgrade-uroot-p

[ERROR]/usr/local/mysql/bin/mysqld: unknown variable 'default _ table_type = innodb'
Comment out default_table_type = INNODB in my. cnf

Scripts for converting all INNODB tables into MYISAM tables
Sed-I's/$ opt_type/$ opt_engine/'/usr/local/mysql/bin/mysql_convert_table_format
/Usr/local/mysql/bin/mysql_convert_table_format-user = 'root'-password = 'veryi. com '-socket ='/tmp/mysql. sock '-type = 'innodb'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.