溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

二進(jìn)制快速安裝mysql5.6.35的步驟

發(fā)布時間:2020-05-19 15:49:52 來源:網(wǎng)絡(luò) 閱讀:171 作者:三月 欄目:MySQL數(shù)據(jù)庫

本文主要給大家簡單講講二進(jìn)制快速安裝mysql5.6.35的步驟,相關(guān)專業(yè)術(shù)語大家可以上網(wǎng)查查或者找一些相關(guān)書籍補(bǔ)充一下,這里就不涉獵了,我們就直奔主題吧,希望二進(jìn)制快速安裝mysql5.6.35的步驟這篇文章可以給大家?guī)硪恍?shí)際幫助。

mysql5.6.35 二進(jìn)制快速安裝

mysql


說明:

mysql安裝在/data/mysql-5.6.35目錄下;

下載

cd /data/
wget 
tar -zxf  mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz 
mv mysql-5.6.35-linux-glibc2.5-x86_64 /data/mysql-5.6.35

新建mysql用戶及設(shè)置權(quán)限

sudo useradd -s /sbin/nologin -M mysql
mkdir -pv  /data/mysql-5.6.35/{var,log}
touch /data/mysql-5.6.35/log/error.log
sudo chown -R mysql:mysql /data/mysql-5.6.35/

添加環(huán)境變量:

vim ~/.bash_profile
export PATH=/data/mysql-5.6.35/bin:$PATH
刷新一下環(huán)境
source ~/.bash_profile

初始化數(shù)據(jù)庫,修改默認(rèn)路徑

cd /data/mysql-5.6.35/
sudo ./scripts/mysql_install_db --basedir=/data/mysql-5.6.35/ --datadir=/data/mysql-5.6.35/data/ --user=mysql

#如果安裝在/usr/local/mysql/目錄下,則兩個sed不許執(zhí)行,因?yàn)槟J(rèn)是/usr/local/目錄下;
sudo sed -i 's#/usr/local/mysql#/data/mysql-5.6.35#g' /data/mysql-5.6.35/bin/mysqld_safe
sudo sed -i 's#/usr/local/mysql#/data/mysql-5.6.35#g' /data/mysql-5.6.35/support-files/mysql.server
sudo ln -s /data/mysql-5.6.35/bin/mysql /usr/bin

修改配置文件

sudo rm –f /etc/my.cnf
sudo vim /data/mysql-5.6.35/my.cnf
[client]
port       = 3306
socket   = /tmp/mysql.sock

[mysqld]
server-id  = 1
port      = 3306
basedir = /data/mysql-5.6.35
datadir  = /data/mysql-5.6.35/data
socket  = /tmp/mysql.sock
binlog-ignore-db  = mysql
log-bin  = /data/mysql-5.6.35/log/mysql-bin
innodb_file_per_table = 1
open_files_limit  = 65535
sql_mode  =NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
skip-host-cache
skip-name-resolve
max_connections  = 1024
wait_timeout  = 31536000
interactive_timeout = 31536000
character-set-server  =utf8mb4
collation-server  = utf8mb4_general_ci
init_connect  = 'SET NAMES utf8mb4'
lower_case_table_names = 1
log_error  = /data/mysql-5.6.35/log/error.log
slow_query_log = 1
slow_query_log_file = /data/mysql-5.6.35/log/slow.log

[mysqld_safe]
err-log= /data/mysql-5.6.35/log/mysqld_safe_err.log
pid-file = /data/mysql-5.6.35/var/mysqld.pid

將服務(wù)腳本復(fù)制到/etc/init.d目錄下,并添加到服務(wù)列表

sudo cp  support-files/mysql.server  /etc/init.d/mysqld

開機(jī)自啟動

sudo chkconfig --add mysqld
sudo chkconfig mysqld on
sudo chkconfig --list mysqld

啟動mysql

sudo  /etc/init.d/mysqld start
ps –ef | grepmysql

設(shè)置mysql密碼

sudo /data/mysql-5.6.35/bin/mysqladmin -u root password 'newpassword'

登錄

mysql  -uroot   -p

配置安全策略:

[root@KVM mysql-5.6.35]#sudo /data/mysql-5.6.35/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL      
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
      
      
      In order to log into MySQL to secure it, we'll need the currentpassword for the root user.  Ifyou've just installed MySQL, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.
      
      Enter current password for root (enter for none):OK, successfully used password, moving on...
      
      Setting the root password ensures that nobody can log into the MySQLroot user without the proper authorisation.
      You already have a root password set, so you can safely answer 'n'.
      Change the root password? [Y/n] n 
      ... skipping.
      
      By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem.  This is intended only fortesting, and to make the installationgo a bit smoother.  You shouldremove them before moving into aproduction environment.
      
      Remove anonymous users? [Y/n] y 
      ... Success!
      
      Normally, root should only be allowed to connect from 'localhost'.  Thisensures that someone cannot guess at the root password from the network.
      Disallow root login remotely? [Y/n] n 
      ... Success!
      
      By default, MySQL comes with a database named 'test' that anyone canaccess.  This is also intended only fortesting, and should be removedbefore moving into a production environment.
      Remove test database and access to it? [Y/n] y 
       - Dropping test database... 
       ... Success! 
       - Removing privileges on testdatabase... 
       ... Success!
      
      Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.
      
      Reload privilege tables now? [Y/n] y 
      ... Success!
      
      All done!  If you've completed allof the above steps, your MySQLinstallation should now be secure.
      Thanks for using MySQL!
      
      Cleaning up...
      [root@KVM mysql-5.6.35]#

二進(jìn)制快速安裝mysql5.6.35的步驟就先給大家講到這里,對于其它相關(guān)問題大家想要了解的可以持續(xù)關(guān)注我們的行業(yè)資訊。我們的板塊內(nèi)容每天都會捕捉一些行業(yè)新聞及專業(yè)知識分享給大家的。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI