本文主要給大家簡單講講linux7.2系統(tǒng)下實現(xiàn)二進(jìn)制安裝MySQL8.0.11方法,相關(guān)專業(yè)術(shù)語大家可以上網(wǎng)查查或者找一些相關(guān)書籍補充一下,這里就不涉獵了,我們就直奔主題吧,希望linux7.2系統(tǒng)下實現(xiàn)二進(jìn)制安裝MySQL8.0.11方法這篇文章可以給大家?guī)硪恍嶋H幫助。
為日照等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及日照網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為網(wǎng)站設(shè)計、成都做網(wǎng)站、日照網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!1、下載二進(jìn)制軟件包:
mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz
2、添加MySQL用戶和組:
[root@localhost ~]# userdel mysql (因為是新系統(tǒng),所以就把現(xiàn)有的MySQL用戶給刪除了) [root@localhost ~]# groupadd mysql [root@localhost ~]# useradd -g mysql mysql [root@localhost ~]# passwd mysql (MySQL密碼要設(shè)置的復(fù)雜一點,或者在創(chuàng)建用戶的時候設(shè)置不讓登陸系統(tǒng))
3、創(chuàng)建安裝MySQL目標(biāo),并解壓軟件到指定目錄
[root@localhost ~]# mkdir -p /mysql/data [root@localhost ~]# chown -R mysql.mysql /mysql [root@localhost ~]# tar zxvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz -C /mysql [root@localhost ~]# cd /mysql [root@localhost ~]# mv mysql-8.0.11-linux-glibc2.12-x86_64 / mysql [root@localhost ~]# chown -R mysql.mysql /mysql
4、初始化數(shù)據(jù)庫
[root@localhost ~]# su - mysql
[mysql@localhost ~]$ vim /mysql/my.cnf
[client] socket=/mysql/data/mysql.sock [mysqld] server-id=142 port = 3306 basedir=/mysql/mysql datadir=/mysql/data socket=/mysql/data/mysql.sock log-error=/mysql/data/mysqld.log pid-file=/mysql/data/mysqld.pid log-bin=/mysql/data/binlog slow_query_log_file = /mysql/data/slow.log log_slave_updates expire_logs_days=7 binlog_format=ROW #default_authentication_plugin=mysql_native_password ---修改密碼加密方式。(看文中最后的解釋) gtid-mode = on enforce-gtid-consistency = 1 skip_slave_start=1 innodb_buffer_pool_size = 1000M innodb_buffer_pool_instances = 2 innodb_log_file_size = 100M innodb_log_files_in_group = 3 innodb_log_buffer_size = 24M innodb_flush_log_at_trx_commit = 1 innodb_file_per_table = 1 innodb_flush_method = O_DIRECT innodb_io_capacity = 200 innodb_io_capacity_max = 600 innodb_thread_concurrency = 0 innodb_autoinc_lock_mode = 2 innodb_lock_wait_timeout = 60 innodb_read_io_threads = 4 innodb_write_io_threads = 4 innodb_max_dirty_pages_pct = 80 innodb_autoextend_increment = 512 innodb_checksum_algorithm = NONE max_connect_errors = 1000 max_connections = 500 connect_timeout = 300 wait_timeout = 86400 interactive_timeout = 86400
[mysql@localhost mysql]$ /mysql/mysql/bin/mysqld --defaults-file=/mysql/my.cnf --user=mysql --basedir=/mysql/mysql/ --datadir=/mysql/data/ --initialize
其中,root的默認(rèn)密碼在:/mysql/data/mysqld.log 日志中,打開查看即可
5、啟動MySQL
[root@localhost mysql]# /mysql/mysql/bin/mysqld_safe --defaults-file=/mysql/my.cnf --user=mysql & [root@localhost mysql]# /mysql/mysql/bin/mysql -uroot -p -S /mysql/data/mysql.sock mysql> set password='123456'; mysql> flush privileges; mysql> \s -------------- /mysql/mysql/bin/mysql Ver 8.0.11 for linux-glibc2.12 on x86_64 (MySQL Community Server - GPL) Connection id: 11 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.0.11 MySQL Community Server - GPL Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /mysql/data/mysql.sock Uptime: 10 min 31 sec Threads: 2 Questions: 10 Slow queries: 0 Opens: 124 Flush tables: 2 Open tables: 100 Queries per second avg: 0.015 --------------
(注意:這里啟動數(shù)據(jù)庫一定要用MySQL8.0安裝包自帶的客戶端才可以登錄,即要使用MySQL8.0安裝包的命令進(jìn)行登錄數(shù)據(jù)庫,要不然會報錯,如:
ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded:)
注意:
在mysql8.0下,默認(rèn)變成了default_authentication_plugin=caching_sha2_password,包括你剛初始化的root用戶也是這個認(rèn)證加密方式,這樣的結(jié)果是讓你除非用新的協(xié)議驅(qū)動,例如必須用8.0自帶的mysql客戶端才行,不然就連接不上數(shù)據(jù)庫.
在mysql5.7環(huán)境里,雖然可以設(shè)置default_authentication_plugin來改變認(rèn)證加密方式,但是一般人不會去設(shè)置.所以默認(rèn)使用的認(rèn)證加密方式是mysql_native_password
解決方法:
①:在初始化的時候在配置文件中加入,如下,mysql_native_password 這種認(rèn)證方法就會很多客戶端的認(rèn)證加密方式一樣。
vim my.cnf
[mysqld]
default_authentication_plugin=mysql_native_password
②:使用命令行模式更改用戶的密碼加密認(rèn)證方式:
mysql> select Host,User,plugin,authentication_string from mysql.user; --看下面的root用戶的認(rèn)證方式和其他用戶都是不一樣的, +-----------+------------------+-----------------------+------------------------------------------------------------------------+ | Host | User | plugin | authentication_string | +-----------+------------------+-----------------------+------------------------------------------------------------------------+ | localhost | mysql.infoschema | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | localhost | mysql.session | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | localhost | mysql.sys | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | localhost | root | caching_sha2_password | $A$005$T?yK{e`l{mrnZd|0iETvMwJ197qvnDXttfzdZX98q6xvFBwXuWd3ioPfnV7 | +-----------+------------------+-----------------------+------------------------------------------------------------------------+ 4 rows in set (0.00 sec) mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; ---在修改密碼的時候指定密碼加密認(rèn)證方式 Query OK, 0 rows affected (0.11 sec) mysql> select Host,User,plugin,authentication_string from mysql.user; ---再次查看所有用戶都一樣了,和5.7版本一樣 +-----------+------------------+-----------------------+-------------------------------------------+ | Host | User | plugin | authentication_string | +-----------+------------------+-----------------------+-------------------------------------------+ | localhost | mysql.infoschema | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | localhost | mysql.session | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | localhost | mysql.sys | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | localhost | root | mysql_native_password | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | +-----------+------------------+-----------------------+-------------------------------------------+ 4 rows in set (0.00 sec)
另外,在MySQL8.0授權(quán)和創(chuàng)建用戶更加嚴(yán)格了,在MySQL5.7可以使用命令如下:
MySQL [(none)]> grant all privileges on *.* to 'test_user'@'192.168.2.%' identified by '123123'; ----MySQL5.7創(chuàng)建用戶授權(quán)的方法,報錯了,
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by '123123'' at line 1
在MySQL8.0中必須先創(chuàng)建用戶再授權(quán):
MySQL > create user 'test_user'@'%' identified by '123456'; --先創(chuàng)建用戶
Query OK, 0 rows affected (0.03 sec)
MySQL > grant all privileges on *.* to 'test_user'@'%' with grant option; --再授權(quán)
Query OK, 0 rows affected (0.05 sec)
linux7.2系統(tǒng)下實現(xiàn)二進(jìn)制安裝MySQL8.0.11方法就先給大家講到這里,對于其它相關(guān)問題大家想要了解的可以持續(xù)關(guān)注我們的行業(yè)資訊。我們的板塊內(nèi)容每天都會捕捉一些行業(yè)新聞及專業(yè)知識分享給大家的。
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
網(wǎng)頁題目:linux7.2系統(tǒng)下實現(xiàn)二進(jìn)制安裝MySQL8.0.11方法-創(chuàng)新互聯(lián)
當(dāng)前鏈接:http://www.rwnh.cn/article14/copede.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、網(wǎng)站收錄、關(guān)鍵詞優(yōu)化、網(wǎng)站設(shè)計公司、網(wǎng)站策劃、定制開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容