centos 6.5安裝MySQL 5.6.35

來源:互聯網
上載者:User

標籤:linux mysql

  • 下載軟體

[[email protected] src]# wget -q http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
  • 解壓

[[email protected] /]# yum -y install gcc gcc-c++ zlib-devel libtool ncurses-devel libxml2-devel cmake[[email protected] /]# useradd -s /sbin/nologin -M mysql[[email protected] /]# mkdir -p /usr/local/mysql[[email protected] /]# mkdir -p /usr/local/mysql/data/mysql[[email protected] /]# cd /usr/local/src/[[email protected] src]# pwd/usr/local/src[[email protected] src]# lsmysql-5.6.35-linux-glibc2.5-x86_64.tar.gz[[email protected] src]# tar xf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz[[email protected] src]# cd mysql-5.6.35
  • 編譯、安裝

[[email protected] mysql-5.6.32]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data/mysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci[[email protected] mysql-5.6.32]# make [[email protected] mysql-5.6.32]# make install[[email protected] mysql-5.6.32]# echo $?0[[email protected] mysql-5.6.32]# cp /usr/local/mysql/support-files/mysql.server  /etc/init.d/mysqld[[email protected] mysql-5.6.32]# chmod +x /etc/init.d/mysqld[[email protected] mysql-5.6.32]# chown -R mysql:mysql /usr/local/mysql/data/mysql[[email protected] mysql-5.6.32]# chown -R mysql:mysql /usr/local/mysql/
  • 初始化資料庫

[[email protected] mysql-5.6.32]# cd /usr/local/mysql/scripts/[[email protected] scripts]# pwd/usr/local/mysql/scripts[[email protected] scripts]# ./mysql_install_db  --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/mysql[[email protected] scripts]#  cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnfcp: overwrite `/etc/my.cnf‘? y[[email protected] scripts]# vim /etc/my.cnf # port = .....# server_id = .....# socket = .....datadir = /usr/local/mysql/data/mysqlport = 3306server_id = 2socket = /usr/local/mysql/mysql.sock# Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size = 128M# sort_buffer_size = 2M# read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLESlower_case_table_names = 1wait_timeout=3600log_bin_trust_function_creators=1max_connections=500
  • 配置環境變數

[[email protected] scripts]# vim /etc/profileexport PATH=$PATH:/usr/local/mysql/bin[[email protected] scripts]# source /etc/profile
  • 啟動服務

[[email protected] scripts]# /etc/init.d/mysqld startStarting MySQL. SUCCESS! [[email protected] scripts]# netstat -nlpt | grep mysqltcp        0      0 :::3306                     :::*                        LISTEN      16434/mysqld  [[email protected] mysql]# lsbin  COPYING  data  docs  include  lib  man  my.cnf  mysql.sock  mysql-test  README  scripts  share  sql-bench  support-files[[email protected] scripts]# mysqlWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.32 Source distributionCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema || test               |+--------------------+4 rows in set (0.00 sec)mysql> exitBye
  • 給root設定密碼

[[email protected] scripts]# mysqladmin -uroot password "123456"Warning: Using a password on the command line interface can be insecure.[[email protected] scripts]# mysql -uroot -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 10Server version: 5.6.32 Source distributionCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql> mysql> mysql> exitBye
  • 建立遠端連線使用者並授權

[[email protected] scripts]# mysql -uroot -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 12Server version: 5.6.32 Source distributionCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql> CREATE USER ‘user‘@‘%‘ IDENTIFIED BY ‘123456‘;Query OK, 0 rows affected (0.00 sec)mysql> GRANT ALL ON *.* TO ‘user‘@‘%‘;Query OK, 0 rows affected (0.00 sec)mysql>


本文出自 “十裡春風” 部落格,請務必保留此出處http://visitor.blog.51cto.com/11247238/1956358

centos 6.5安裝MySQL 5.6.35

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.