mysql 5.7.12二進位安裝

來源:互聯網
上載者:User

標籤:error   cat   alter   mysql 5.7   pac   open   basedir   amp   sbin   

1.my.cnf設定檔參數:
vim /etc/my.cnf

[client]port            = 3306socket          = /tmp/mysql.sock[mysql]no-auto-rehash[mysqld]user    = mysqlport    = 3306socket  = /tmp/mysql.sockbasedir = /aliyun/server/mysql-5.7.12/datadir = /data/mysql/data/open_files_limit    = 1024back_log = 600max_connections = 800max_connect_errors = 3000table_cache = 614external-locking = FALSEmax_allowed_packet =8Msort_buffer_size = 1Mjoin_buffer_size = 1Mthread_cache_size = 100thread_concurrency = 2query_cache_size = 2Mquery_cache_limit = 1Mquery_cache_min_res_unit = 2kthread_stack = 192Ktmp_table_size = 2Mmax_heap_table_size = 2Mlong_query_time = 1pid-file = /data/mysql/mysql.pidlog-bin = /data/mysql/logs/bin-log/mysql-binserver_id = 1relay-log = /data/mysql/logs/relay-log/relay-binrelay-log-info-file = /data/mysql/relay-log.infobinlog_cache_size = 1Mmax_binlog_cache_size = 1Mmax_binlog_size = 2Mexpire_logs_days = 7key_buffer_size = 16Mread_buffer_size = 1Mread_rnd_buffer_size = 1Mbulk_insert_buffer_size = 1Mlower_case_table_names = 1skip-name-resolveslave-skip-errors = 1032,1062replicate-ignore-db=mysqlinnodb_additional_mem_pool_size = 4Minnodb_buffer_pool_size = 32Minnodb_data_file_path = ibdata1:10M:autoextendinnodb_file_io_threads = 4innodb_thread_concurrency = 8innodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 2Minnodb_log_file_size = 4Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120innodb_file_per_table = 0[mysqldump]quickmax_allowed_packet = 2M[mysqld_safe]log-error=/data/mysql/logs/error.logpid-file=/data/mysql/mysqld_safe.pid

2.安裝過程:

useradd mysql -s /sbin/nologin -Mmkdir /aliyun/server -pmkdir /data/mysql/{logs,data} -pmkdir /data/mysql/logs/{relay-log,bin-log} -ptar xf /aliyun/soft/mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz -C /aliyun/server/mv /aliyun/server/mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz /aliyun/server/mysql-5.7.12cd /aliyun/sereverln -s mysql-5.7.12 mysqlchown -R mysql:mysql /data/mysqlchown -R mysql:mysql /aliyun/server/mysql-5.7.12cd /aliyun/server/mysql-5.7.12/./bin/mysqld --initialize --user=mysql --basedir=/aliyun/server/mysql-5.7.12/  --datadir=/data/mysql/datamysql5.7在初始化時,會預設生產一串隨機的密碼VeU3gVM85K*p  初始化產生的密碼cp /aliyun/server/mysql/support-files/my-default.cnf /etc/my.cnfcp /aliyun/server/mysql-5.7.12/support-files/mysql.server /etc/init.d/mysqlchkconfig --add mysqlchkconfig  mysql oncp /aliyun/server/mysql/bin/* /usr/local/sbin/或者是ln -s /aliyun/server/mysql/bin/* /usr/local/sbin/ 做軟串連代替cp複製重啟mysql:/etc/init.d/mysqld start/etc/init.d/mysqld stop

3.修改初始化密碼:
mysql -uroot -p"VeU3gVM85K*p"
修改初始化密碼
mysql> alter user user() identified by ‘123456‘;

到此處二進位安裝完畢

4.mysql 5.7.12安裝完後登陸報錯提示密碼到期:

mysql 5.7.12安裝完後登陸報錯,意思是密碼到期
[[email protected] mysql]# mysql -uroot -p‘qajHy,Gwa7jr‘
ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.

mysqld_safe --user=mysql--datadir=/data/mysql/data --skip-grant-tables --skip-networking &
這樣就可以免密碼登入了。
然後修改該使用者密碼到期策略為N:
update mysql.user set password_expired="N" where user="root";
flush privileges;

mysql> \q

service mysql restart
重啟mysql,用到期的密碼就可以登陸了,登陸之後可以用下面的命令修改密碼

>alter user user() identified by ‘123456‘;Query OK, 0 rows affected (0.03 sec)>flush privileges;Query OK, 0 rows affected (0.03 sec)

mysql 5.7.12二進位安裝

聯繫我們

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