MySQL Series-MySQL source installation configuration

Source: Internet
Author: User

Second, MySQL series-MySQL source installation configuration (with the latest version of 5.7)
1. Environment-dependent preparation
2. Start the installation
2.1. Download MySQL
2.2. Decompression
2.3. Assigning Permissions
2.4. Modify the configuration file
2.5. Start MySQL
3, MySQL 5.7 source installation of different places

Second, MySQL series-MySQL source installation configuration (with 5.7 and other latest version) 1, environment-dependent preparation
    • Make installation
      Make compiler: http://www.gnu.org/software/make/
 
   
  
  1. # tar zxvf make-3.82.tar.gz
  2. # cd make-3.82
  3. # ./configure
  4. # make
  5. # make install
    • Bison Installation
      bison:http://www.gnu.org/software/bison/
 
   
  
  1. # tar zxvf bison-2.5.tar.gz
  2. # cd bison-2.5
  3. # ./configure
  4. # make
  5. # make install
    • gcc-c++ Installation
      gcc-c++:http://www.gnu.org/software/gcc/
 
   
  
  1. # tar zxvf gcc-c++-4.4.4.tar.gz
  2. # cd gcc-c++-4.4.4
  3. #./configure
  4. # make
  5. # make install
    • CMake Installation
      cmake:http://www.cmake.org/
 
   
  
  1. # tar zxvf cmake-2.8.4.tar.gz
  2. # cd cmake-2.8.4
  3. #./configure
  4. # make
  5. # make install
    • ncurses Installation
      ncurses:http://www.gnu.org/software/ncurses/
 
   
  
  1. # tar zxvf ncurses-5.8.tar.gz
  2. # cd ncurses-5.8
  3. #./configure
  4. # make
  5. # make install
2. Start installation 2.1, download MySQL

mysql5.6:http://dev.mysql.com/
Here i download the mysql-5.6.12.tar.gz here
ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.6/

  
 
  1. # groupadd mysql
  2. # useradd mysql -g mysql -M -s /sbin/nologin
  3. #增加一个名为 mysql的用户。
  4. -g:指定新用户所属的用户组(group)
  5. -M:不建立根目录
  6. -s:定义其使用的shell,/sbin/nologin代表用户不能登录系统。
2.2. Decompression

Unzip and install MySQL

  
 
  1. # tar zxvf mysql-5.6.12.tar.gz
  2. # cd mysql-5.6.12
  3. CMake./ -Dcmake_install_prefix=/usr/Local/MySQL-Dmysql_datadir=/usr/Local/MySQL/Data-Dsysconfdir=/etc-Dwith_myisam_storage_engine=1 -Dwith_innobase_storage_engine=1 -Dwith_memory_storage_engine=1 -Dwith_readline=1 -dmysql_unix_addr=/tmp/mysqld.sock-Dmysql_tcp_port=3306 -Denabled_local_infile=1 -Dwith_partition_storage_engine=1 -dextra_charsets= All-Ddefault_charset=UTF8-ddefault_collation=Utf8_general_ci
  4. # make
  5. # make install
2.3. Assigning Permissions
 
   
  
  1. # cd /usr/local/mysql
  2. # chown -R mysql:mysql . (#这里最后是有个.的大家要注意# 为了安全安装完成后请修改权限给root用户)
  3. # scripts/mysql_install_db --user=mysql (先进行这一步再做如下权限的修改)
  4. # chown -R root:mysql . (将权限设置给root用户,并设置给mysql组, 取消其他用户的读写执行权限,仅留给mysql "rx"读执行权限,其他用户无任何权限)
  5. # chown -R mysql:mysql ./data (数据库存放目录设置成mysql用户mysql组)
  6. # chmod -R ug+rwx . (赋予读写执行权限,其他用户权限一律删除仅给mysql用户权限)
2.4. Modify the configuration file
  
 
  1. 下面的命令是将mysql的配置文件拷贝到/etc
  2. # cp support-files/my-default.cnf /etc/my.cnf
  3. (5.6之前的版本用如下命令)
  4. # cp support-files/my-medium.cnf /etc/my.cnf (5.6之前的版本是此操作,读者也可在此时自己进入support-files文件夹下面,看是配置文件的真正名称,那个存在,就拷贝那个。。)
  5. 修改my.cnf配置
  6. # vi /etc/my.cnf
  7. #[mysqld] 下面添加:
  8. user=mysql
  9. datadir=/data/mysql
  10. default-storage-engine=MyISAM
2.5. Start MySQL
 
   
  
  1. # bin/mysqld_safe --user=mysql & 或者直接进入bin文件夹下面
  2. # cd bin
  3. #./mysqld \ 这里说明,mysqld_safe或者mysqld都可以启动的
  4. 启动mysql,看是否成功
  5. # ps –ef|grep mysql

The above is a way to start MySQL, there is a simple convenience, as follows:

  
 
  1. 将mysql的启动服务添加到系统服务中
  2. # cp support-files/mysql.server /etc/init.d/mysql
  3. 现在可以使用下面的命令启动mysql
  4. # service mysql start
  5. 停止mysql服务
  6. # service mysql stop
  7. 重启mysql服务
  8. # service mysql restart
3, MySQL 5.7 source installation of different places
    • CMake version must be at least 2.8
    • Depending on the boost library, you need to add the following options when CMake
      -ddownload_boost=1-dwith_boost=/usr/local/boost
    • Initialize and start
  
 
  1. 在5.7.6之前初始化的方法是:bin/mysql_install_db --user=mysql 5.7.6之后的版本初始化数据库不再使用mysql_install_db
  2. bin/mysqld --initialize --user=mysql --basedir=/package/mysql --datadir=/package/mysql/data --innodb_undo_tablespaces=3
  3. bin/mysql_ssl_rsa_setup
  4. cp support-files/mysql.server /etc/init.d/mysql
  5. bin/./mysqld_safe --skip-grant-tables --skip-networking &
  6. 在5.7中存储密码的字段不再是password了,变成了authentication_string
  7. update mysql.user set authentication_string=password(‘root‘) where user=‘root‘
  8. SET PASSWORD=PASSWORD(‘root‘);


Null

MySQL Series-MySQL source installation configuration

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.