MySQL 5.5.8 to use cmake compilation 1) Create User # Useradd-r-s/sbin/nologin mysql# ID mysqluid=101 (mysql) gid=101 (MySQL) groups=101 (MySQL) # Chown-r mysql.mysql/data/mysql/
Description: # which Cmake/usr/local/bin/cmake
2) Compile cmake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql-dsysconfdir=/etc-dwith_innobase_storage_ Engine=1-dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1-dwith_readline=1-dwith_ssl=system- dwith_zlib=system-dwith_libwrap=0-dmysql_unix_addr=/tmp/mysql.sock-ddefault_charset=utf8-ddefault_collation= Utf8_general_ci
3) Initialize mysql# chown-r: MySQL. (slightly different from binary installation, when binary is installed, the owner and the group are root, this is compiled, the host and the group is MySQL)
# scripts/mysql_install_db--user=mysql--datadir=/data/mysql/
4) config file # cp support-files/my-large.cnf/etc/my.cnfin the [Mysqld], specify the path to the databaseDataDir =/data/mysql
5) Service script# CP Support-files/mysql.server/etc/init.d/mysqld Precautions after installation
1) Delete anonymous user (otherwise cause system vulnerability)mysql> use MySQL;
Mysql> select User,host,password from user;
There are two anonymous users
+------+-----------------------+-------------------------------------------+
| user | host | password |
+------+-----------------------+-------------------------------------------+
| root | localhost | *A3CD8B69C29498EBAAAFC325115D21B6A630A9F9 |
| root | localhost.localdomain | *A3CD8B69C29498EBAAAFC325115D21B6A630A9F9 |
| root | 127.0.0.1 | *A3CD8B69C29498EBAAAFC325115D21B6A630A9F9 |
| | localhost | |
| |
localhosT . Localdomain | |
+------+-----------------------+-------------------------------------------+
mysql> drop user ' @ ' localhost '; Query OK, 0 rows Affected (0.00 sec) mysql> Drop user ' @ ' localhost.localdomain '; Query OK, 0 rows Affected (0.00 sec)
2) Add password for root user (in MySQL client, command is case insensitive) method # mysqladmin-u username-h HOSTNAME password ' new_pass '-p method 2mysql> SET PASSWORD for ' USERNAME ' @ ' HOST ' =password (' new_pass '); Method 3mysql>Update user set Password=password (' Hiayng ') where user= ' root ';
Select User,host,password from user;
3) in the home directory to establish the following files, attention to permissions, can be free of input password [client]user=rootpassword=hiyanghost=127.0.0.1c/s communication mode in the same host using mysql.socket communication in different host tcp/ IP communication
MyISAM stored table contains 3 files. frm:The table structure definition file. MYD: Table data. MYI: Table Index
InnoDBThe stored table contains 3 filesAll tables share a table space file; Recommendation: A separate tablespace file for each table, but some new features do not support . frm: Table structure . IBD: Table space (table data and table index)
Set a separate tablespace for each table 1) view,innodb_file_per_table not open
mysql> show variables like "%innodb_file%";
+--------------------------+----------+
| Variable_name | Value |
+--------------------------+----------+
| innodb_file_format | Antelope |
| innodb_file_format_check | ON |
| innodb_file_format_max | Antelope |
| innodb_file_per_table | OFF |
+--------------------------+----------+
2) Edit config file # vim/etc/my.cnf added under [mysqld]
innodb_file_per_table = 1
3) The test will test reload will not take effect and must be restarted
# service mysqld restart
As follows
mysql> show variables like "%innodb_file%";
+--------------------------+----------+
| Variable_name | Value |
+--------------------------+----------+
| innodb_file_format | Antelope |
| innodb_file_format_check | ON |
| innodb_file_format_max | Antelope |
| innodb_file_per_table | ON |
+--------------------------+----------+
Create the InnoDB table (the default creation table after 5.5.8 is InnoDB format) mysql> CREATE DATABASE mydb;
mysql> use mydb;database changedmysql> CREATE TABLE TEST_TB (ID int. not null,name char (30));
# ls./mydbdb.opt test_tb.frm test_tb.ibd# The character set and collation used by the current table# Cat Db.opt Default-character-set=utf8default-collation=utf8_general_ci
From for notes (Wiz)
Source code compilation Install MySQL