Source code compilation Install MySQL

Source: Internet
Author: User
Tags mysql client

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
  
 
  1. +------+-----------------------+-------------------------------------------+
  2. | user | host                  | password                                  |
  3. +------+-----------------------+-------------------------------------------+
  4. | root | localhost             | *A3CD8B69C29498EBAAAFC325115D21B6A630A9F9 |
  5. | root | localhost.localdomain | *A3CD8B69C29498EBAAAFC325115D21B6A630A9F9 |
  6. | root | 127.0.0.1             | *A3CD8B69C29498EBAAAFC325115D21B6A630A9F9 |
  7. | | localhost | |
  8. | | localhosT                                                  . Localdomain | |
  9. +------+-----------------------+-------------------------------------------+
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
  
 
  1. mysql> show variables like "%innodb_file%";
  2. +--------------------------+----------+
  3. | Variable_name | Value |
  4. +--------------------------+----------+
  5. | innodb_file_format | Antelope |
  6. | innodb_file_format_check | ON |
  7. | innodb_file_format_max | Antelope |
  8. | innodb_file_per_table | OFF |
  9. +--------------------------+----------+
2) Edit config file # vim/etc/my.cnf added under [mysqld]
 
   
  
  1. innodb_file_per_table = 1
3) The test will test reload will not take effect and must be restarted
 
   
  
  1. # service mysqld restart
As follows
  
 
  1. mysql> show variables like "%innodb_file%";
  2. +--------------------------+----------+
  3. | Variable_name            | Value    |
  4. +--------------------------+----------+
  5. | innodb_file_format       | Antelope |
  6. | innodb_file_format_check | ON       |
  7. | innodb_file_format_max   | Antelope |
  8. | innodb_file_per_table    | ON       |
  9. +--------------------------+----------+
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

Related Article

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.