二进制方式安装mysql 5.7.19的最新方法
admin
2023-05-16 20:42:25
0

下文我给大家简单讲讲关于二进制方式安装mysql 5.7.19的最新方法,大家之前了解过相关类似主题内容吗?感兴趣的话就一起来看看这篇文章吧,相信看完二进制方式安装mysql 5.7.19的最新方法对大家多少有点帮助吧。

一、优化部分

1.操作系统参数调优

2.数据库参数调优

3.防火墙设置等

#############################

二、安装部分

1.创建用户和组

# groupadd mysql

# useradd -g mysql mysql


2.创建数据库安装目录、授权

# mkdir /mysql /mysql/data /mysql/log 

# chown -R mysql:mysql /usr/local/mysql 


3.到安装目录,解压安装文件

#cd /usr/local

# tar -zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz

# mv mysql-5.7.19-linux-glibc2.12-x86_64 mysql


4.授权

# chown -R mysql.mysql mysql


5.验证权限

# ls -l mysql

total 52

drwxr-xr-x  2 mysql mysql  4096 Aug  8 04:06 bin

-rw-r--r--  1 mysql mysql 17987 Jun 22 22:13 COPYING

drwxr-xr-x  2 mysql mysql  4096 Aug  8 04:06 docs

drwxr-xr-x  3 mysql mysql  4096 Aug  8 04:06 include

drwxr-xr-x  5 mysql mysql  4096 Aug  8 04:06 lib

drwxr-xr-x  4 mysql mysql  4096 Aug  8 04:06 man

-rw-r--r--  1 mysql mysql  2478 Jun 22 22:13 README

drwxr-xr-x 28 mysql mysql  4096 Aug  8 04:06 share

drwxr-xr-x  2 mysql mysql  4096 Aug  8 04:06 support-files


6.编辑参数文件

vim /etc/my.cnf


[client]

port = 3306

socket = /tmp/mysql.sock


[mysqld]

server_id=10

port = 3306

user = mysql

character-set-server = utf8mb4

default_storage_engine = innodb

log_timestamps = SYSTEM

socket = /tmp/mysql.sock

basedir = /usr/local/mysql

datadir = /mysql/data

pid-file = /mysql/data/mysql.pid

max_connections = 1000

max_connect_errors = 1000

table_open_cache = 1024

max_allowed_packet = 128M

open_files_limit = 65535

#####====================================[innodb]==============================

innodb_buffer_pool_size = 1024M

innodb_file_per_table = 1

innodb_write_io_threads = 4

innodb_read_io_threads = 4

innodb_purge_threads = 2

innodb_flush_log_at_trx_commit = 1

innodb_log_file_size = 512M

innodb_log_files_in_group = 2

innodb_log_buffer_size = 16M

innodb_max_dirty_pages_pct = 80

innodb_lock_wait_timeout = 30

innodb_data_file_path=ibdata1:1024M:autoextend

innodb_undo_tablespaces=3

#####====================================[log]==============================

log_error = /mysql/log/mysql-error.log 

slow_query_log = 1

long_query_time = 1 

slow_query_log_file = /mysql/log/mysql-slow.log

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES



7.安装数据库

# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/data  --innodb_undo_tablespaces=3 --explicit_defaults_for_timestamp


8.配置启动文件

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

chkconfig --add mysql

chkconfig mysql on

service mysql start


9.配置环境变量


vi /etc/profile

#for mysql  

mysql_home=/usr/local/mysql

PATH=$PATH:$mysql_home/bin

source /etc/profile


10.查看默认密码

grep -i password /mysql/log/mysql-error.log 


11.初始化密码

mysql -uroot -p'xxxxx'

SET PASSWORD=PASSWORD('root');

flush privileges;


12.数据库常规启停

# mysqladmin -uroot -proot shutdown

#mysqld_safe --defaults-file=/etc/my.cnf &

#ps -ef|grep mysql



13.安全配置

# mysql_secure_installation 

Securing the MySQL server deployment.


Enter password for user root: 


VALIDATE PASSWORD PLUGIN can be used to test passwords

and improve security. It checks the strength of password

and allows the users to set only those passwords which are

secure enough. Would you like to setup VALIDATE PASSWORD plugin?


Press y|Y for Yes, any other key for No: y


There are three levels of password validation policy:


LOW    Length >= 8

MEDIUM Length >= 8, numeric, mixed case, and special characters

STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file


Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2

Using existing password for root.


Estimated strength of the password: 25 

Change the password for root ? ((Press y|Y for Yes, any other key for No) : y


New password: 


Re-enter new password: 

Sorry, passwords do not match.


New password: 


Re-enter new password: 

Sorry, passwords do not match.


New password: 


Re-enter new password: 


Estimated strength of the password: 50 

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

 ... Failed! Error: Your password does not satisfy the current policy requirements


New password: 


Re-enter new password: 


Estimated strength of the password: 100 

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

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 for

testing, and to make the installation go a bit smoother.

You should remove them before moving into a production

environment.


Remove anonymous users? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y

Success.


By default, MySQL comes with a database named 'test' that

anyone can access. This is also intended only for testing,

and should be removed before moving into a production

environment.



Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

 - Dropping test database...

Success.


 - Removing privileges on test database...

Success.


Reloading the privilege tables will ensure that all changes

made so far will take effect immediately.


Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

Success.


All done! 

大家觉得二进制方式安装mysql 5.7.19的最新方法这篇文章怎么样,是否有所收获。如果想要了解更多相关,可以继续关注我们的行业资讯板块。 

相关内容

热门资讯

去青海察尔汗盐湖捡盐块留念成新... 近日,一网友发帖,自己从青海察尔汗盐湖景区捡拾盐块带回家做纪念,评论区有人称盐块存在放射性,引发关注...
卢秀燕呼吁蓝白合:2026“倒... 据香港中评社8月2日报道,国民党籍台中市长卢秀燕今天受邀出席台湾民众党7周年党庆,呼吁蓝白合坚定前行...
8年后回应姗姗来迟,真相还有人... 八年了,李小璐想起来回应“做头发”事件了。而且这次,她一次性抛出了不少新信息,表示广为流传的“做头发...
男子在攀岩馆从高空坠落,目击者... 8月2日中午,北京大型攀岩馆超级奥攀,一名男子从高空坠落,随后被送医治疗,多名网友发帖留言称确有此事...
小红书黑红启示录:旅游帖诈骗冲... #小红书旅游帖诈骗#冲上了热搜。一位妈妈带孩子在大连,沿着小红书攻略找那条海底隧道——满心想着给孩子...
天然气灶不打火怎么回事 可能由以下原因导致天然气灶不打火:1、燃气阀门未开启:检查气阀是否处于关闭状态。2、灶具没有点火:可...
空调遥控器按开关没反应 原因可能是遥控器里面的发光管损坏,导致屏幕不显示,可以维修或更换遥控器解决;原因可能是遥控器的红外发...
油烟机开关按了没反应 油烟机开关按了没反应油烟机开关按了没反应的原因有可能是开关按钮损坏;电源接头没有连接;电路板损坏、传...
马桶水箱按钮按不动 有因有:马桶按钮内的弹簧生锈老化;出水阀被泥沙等杂物卡住;水漂卡住了。需打开马桶水箱看看联动冲水阀连...
德意油烟机按不动怎么办 如果德意油烟机按不动,首先需要确认是否是电源问题。你可以检查油烟机的插头是否插紧了,插座是否正常工作...