日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql5.6.35安装_mysql5.6.35 二进制快速安装

發布時間:2025/3/11 数据库 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql5.6.35安装_mysql5.6.35 二进制快速安装 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

說明:

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

如果安裝在/usr/local/mysql/目錄下,則兩個sed不許執行,因為默認是/usr/local/目錄下;

1.下載

cd /data/

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

2.新建mysql用戶及設置權限

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/

3.添加環境變量:

vim ~/.bash_profile

export PATH=/data/mysql-5.6.35/bin:$PATH

source ~/.bash_profile

4.初始化數據庫,修改默認路徑

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

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

5.修改配置文件

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

6.將服務腳本復制到/etc/init.d目錄下,并添加到服務列表

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

7.開機自啟動

sudo chkconfig --add mysqld

sudo chkconfig mysqld on

sudo chkconfig --list mysqld

8.啟動mysql

sudo ?/etc/init.d/mysqld start

ps –ef | grepmysql

9.設置mysql密碼

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

10.登錄

mysql ?-uroot?? -p

11.配置安全策略:

[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 current

password for the root user.? Ifyou've just installed MySQL, and

you 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 MySQL

root 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 anyone

to log into MySQL without having to have a user account created for

them.? This is intended only fortesting, and to make the installation

go a bit smoother.? You shouldremove them before moving into a

production environment.

Remove anonymous users? [Y/n]?y

... Success!

Normally, root should only be allowed to connect from 'localhost'.? This

ensures 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 can

access.? This is also intended only fortesting, and should be removed

before 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 far

will take effect immediately.

Reload privilege tables now? [Y/n]?y

... Success!

All done!? If you've completed allof the above steps, your MySQL

installation should now be secure.

Thanks for using MySQL!

Cleaning up...

[root@KVM mysql-5.6.35]#

本文轉自898009427 51CTO博客,原文鏈接:http://blog.51cto.com/moerjinrong/1929288,如需轉載請自行聯系原作者

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的mysql5.6.35安装_mysql5.6.35 二进制快速安装的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。