Centos7一鍵安裝mysql

來源:互聯網
上載者:User

標籤:scripts   socket   _for   nss   my.cnf   binlog   set   5.6   commit   

#!/bin/bash#system:Centos7#mysql.tar.gz is glibc#Download url https://dev.mysql.com/downloads/mysql/#Example download #https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.41-linux-glibc2.12-x86_64.tar.gz#sh mysql_install.sh mysql-5.6.41-linux-glibc2.12-x86_64.tar.gzcase $1 in"")echo "Example: sh mysql_install.sh mysql-glibc.tar.gz"exit 1;;*)if test ! -f $1thenecho "Dir or Filename Error!"elseyum -y install autoconf libaio-devel perl-Module-Install.noarchmkdir /opt/mysqlmkdir /datatar -xvf $1 -C /opt/mysql --strip-components 1useradd -r mysql -s /sbin/nologinchown -R mysql.mysql /datachown -R mysql.mysql /opt/mysqlcd /opt/mysql/scripts/./mysql_install_db --basedir=/opt/mysql/ --datadir=/data --user=mysql --pid-file=/opt/mysql/mysql.pidcp /opt/mysql/support-files/mysql.server /etc/init.d/mysqldchmod +x /etc/init.d/mysqldcat>/etc/my.cnf <<END[mysqld] basedir = /opt/mysql datadir = /data socket = /tmp/mysql.sock pid-file =/opt/mysql/mysql.pid log-bin=mysql-bin binlog_format=mixed character-set-server = utf8 max_connections = 1000 default_storage_engine = InnoDB innodb_file_per_table = 1 innodb_open_files = 500 innodb_buffer_pool_size = 64M innodb_write_io_threads = 4 innodb_read_io_threads = 4 innodb_thread_concurrency = 0 innodb_purge_threads = 1 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 2M innodb_log_file_size = 32M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_lock_wait_timeout = 120 interactive_timeout = 28800 wait_timeout = 28800 lower_case_table_names=1 event_scheduler=1 skip-name-resolve=1 max_allowed_packet=30MENDln -s /opt/mysql/bin/* /usr/sbin//etc/init.d/mysqld startecho "/etc/init.d/mysqld start" >>/etc/rc.localchmod +x /etc/rc.localmysql_passwd=`openssl rand -base64 9`mysqladmin -u root password "$mysql_passwd"mysql -uroot -p$mysql_passwd -e "delete from mysql.user where user=‘‘; delete from mysql.db where user=‘‘;"echo "port 3306"echo "basedir /opt/mysql"echo "datadir /data"echo "root passwd:$mysql_passwd"fi;;esac

Centos7一鍵安裝mysql

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.