mysql 5.5中InnoDB作为默认的数据库存储引擎,mysql-5.1升级mysql到mysql-5.5以后,以下程序需要重新编译安装升级:PHP 5.3.6
mysql 5.5中InnoDB作为默认的数据库存储引擎,mysql-5.1升级mysql到mysql-5.5以后,以下程序需要重新编译安装升级:
PHP 5.3.6
cacti spine
pureftp
安装
wget ://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
修改server-id = 1为服务器ip地址最后几位,或者其它数值:
cd /usr/local/mysql/etc/
vim my.cnf
#max_allowed_packet = 1M
server-id = 8108
max_allowed_packet = 64M
max_connections=800
character-set-server=utf8
expire_logs_days = 60
binlog_format=mixed
log-bin=mysql-bin
#read_only=1
#slave-skip-errors=1062,1032,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:2000M;ibdata2:2000M;ibdata3:20M:autoextend
innodb_log_group_home_dir = /opt/data/mysql/
# 4G RAM
innodb_buffer_pool_size = 1G
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit=0
innodb_thread_concurrency=8
innodb_flush_method=O_DIRECT
# perform
tmp_table_size = 512M
max_heap_table_size=128M
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/mysqld.pid
添加数据库用户
/usr/sbin/groupadd -g 502 mysql
/usr/sbin/useradd -u 502 -g mysql 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/mysql.sock
#/usr/local/mysql/bin/mysqld_safe &
mkdir -p /var/run/mysqld/
chown mysql /var/run/mysqld/
#加入mysql到路径
echo pathmunge /usr/local/mysql/bin after > /etc/profile.d/mysql.sh
#执行一下,保证mysql在路径环境变量中
. /etc/profile
mysql5.1升级到mysql5.5
mysql_upgrade包含一下三个命令:
# mysqlcheck –check-upgrade –all-databases –auto-repair
# mysql_fix_privilege_tables
# mysqlcheck –all-databases –check-upgrade –fix-db-names –fix-table-names
在每一次的升级过程中,建议执行mysql_upgrade这个命令,,通过mysqlcheck命令帮我们去检查表是否兼容新版本的数据库同时作出修复,使用mysql_fix_privilege_tables命令去升级权限表。
/usr/local/mysql/bin/mysql_upgrade -uroot -p
[ERROR] /usr/local/mysql/bin/mysqld: unknown variable 'default_table_type=INNODB'
注释my.cnf中的default_table_type=INNODB
把所有INNODB表转换成MYISAM表的脚本
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'

ACID attributes include atomicity, consistency, isolation and durability, and are the cornerstone of database design. 1. Atomicity ensures that the transaction is either completely successful or completely failed. 2. Consistency ensures that the database remains consistent before and after a transaction. 3. Isolation ensures that transactions do not interfere with each other. 4. Persistence ensures that data is permanently saved after transaction submission.

MySQL is not only a database management system (DBMS) but also closely related to programming languages. 1) As a DBMS, MySQL is used to store, organize and retrieve data, and optimizing indexes can improve query performance. 2) Combining SQL with programming languages, embedded in Python, using ORM tools such as SQLAlchemy can simplify operations. 3) Performance optimization includes indexing, querying, caching, library and table division and transaction management.

MySQL uses SQL commands to manage data. 1. Basic commands include SELECT, INSERT, UPDATE and DELETE. 2. Advanced usage involves JOIN, subquery and aggregate functions. 3. Common errors include syntax, logic and performance issues. 4. Optimization tips include using indexes, avoiding SELECT* and using LIMIT.

MySQL is an efficient relational database management system suitable for storing and managing data. Its advantages include high-performance queries, flexible transaction processing and rich data types. In practical applications, MySQL is often used in e-commerce platforms, social networks and content management systems, but attention should be paid to performance optimization, data security and scalability.

The relationship between SQL and MySQL is the relationship between standard languages and specific implementations. 1.SQL is a standard language used to manage and operate relational databases, allowing data addition, deletion, modification and query. 2.MySQL is a specific database management system that uses SQL as its operating language and provides efficient data storage and management.

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

Key metrics for EXPLAIN commands include type, key, rows, and Extra. 1) The type reflects the access type of the query. The higher the value, the higher the efficiency, such as const is better than ALL. 2) The key displays the index used, and NULL indicates no index. 3) rows estimates the number of scanned rows, affecting query performance. 4) Extra provides additional information, such as Usingfilesort prompts that it needs to be optimized.

Usingtemporary indicates that the need to create temporary tables in MySQL queries, which are commonly found in ORDERBY using DISTINCT, GROUPBY, or non-indexed columns. You can avoid the occurrence of indexes and rewrite queries and improve query performance. Specifically, when Usingtemporary appears in EXPLAIN output, it means that MySQL needs to create temporary tables to handle queries. This usually occurs when: 1) deduplication or grouping when using DISTINCT or GROUPBY; 2) sort when ORDERBY contains non-index columns; 3) use complex subquery or join operations. Optimization methods include: 1) ORDERBY and GROUPB


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor