mysql 安装 se_mysql-5.7安装

安装包mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz

1.更改selinux为disable,关闭防火墙

vim /etc/sysconfig/selinux

SELINUX = disabled

查看防火墙状态

firewall-cmd --state

停止firewall

systemctl stop firewalld.service

禁止firewall开机启动

systemctl disable firewalld.service

getenforce

setenforce 0

修改系统的软硬限制来防止系统错误的发生,编辑/etc/security/limits.conf

* soft nproc 65535

* hard nproc 65535

* soft nofile 65535

* hard nofile 65535

建好Mysql用户和所属组

groupadd mysql

useradd mysql -s /sbin/nologin -M

解压,做软链接

ln -s /usr/local/src/mysql-5.7.24-linux-glibc2.12-x86_64 /usr/local/mysql

chown mysql:mysql -R mysql

5.创建数据库目录,授予权限

mkdir -p /data/mysql

chown mysql:mysql -R /data/mysql

6.初始化数据库,指定data目录

yum install -y perl-Data-Dumper.x86_64

yum install libaio*

如果之前已经安装过数据库

mysqld --no-defaults --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

记住密码

···

7 .启动

scp support-files/mysql.server /etc/init.d/mysqld

vim /etc/init.d/mysqld

datadir = /data/mysql

/etc/init.d/mysql start

8.常用mysql命令

修改密码

alter user user() identified by "123456";

flush privileges;

开启远程登录

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

flush privileges;

查看mysql 的用户名密码

select host,user,authentication_string from mysql.user;

my.cnf(16G)

[client]

port = 3306

socket = /tmp/mysql.sock

[mysql]

auto-rehash

prompt = "\\u@\\h \\d>"

[mysqld]

user = mysql

port = 3306

basedir = /usr/local/mysql

datadir = /data/mysql/

socket = /tmp/mysql.sock

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

character-set-server = utf8

collation-server = utf8_general_ci

skip_name_resolve = 1

skip-external-locking

open_files_limit = 65535

back_log = 600

max_connections = 3000

max_connect_errors = 600000

table_open_cache = 5120

table_definition_cache = 1024

table_open_cache_instances= 64

thread_stack = 512k

external-locking =FALSE

max_allowed_packet = 512M

sort_buffer_size = 16M

join_buffer_size = 16M

thread_cache_size = 300

query_cache_size = 64M

query_cache_limit = 4M

query_cache_min_res_unit = 2k

default_storage_engine = InnoDB

explicit_defaults_for_timestamp = 1

#skip-networking

interactive_timeout = 1800

wait_timeout = 1800

tmp_table_size = 32M

max_heap_table_size = 256M

slow_query_log = 1

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

long_query_time = 2

log_error = /data/mysql/error.log

server-id = 3306101

log-bin = /data/mysql/mysql-bin

sync_binlog = 1

expire_logs_days = 14

gtid_mode = on

enforce_gtid_consistency = 1

log_slave_updates

binlog_format = row

relay_log_recovery = 1

relay_log_purge = 1

relay-log = /data/mysql/relay-bin

relay-log-info-file = /data/mysql/relay-log.info

binlog_cache_size = 16M

max_binlog_cache_size = 8M

max_binlog_size = 512M

key_buffer_size = 32M

read_buffer_size = 8M

read_rnd_buffer_size = 4M

bulk_insert_buffer_size = 32M

lock_wait_timeout = 3600

#explict_defaults_for_timestamp = 1

#explict_defaults_for_timestamp=1

lower_case_table_names = 1

slave-skip-errors = 1032,1062

sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

innodb_thread_concurrency = 0

innodb_sync_spin_loops = 100

innodb_spin_wait_delay = 30

transaction_isolation = REPEATABLE-READ

innodb_buffer_pool_size = 1G

innodb_buffer_pool_instances = 8

innodb_buffer_pool_load_at_startup = 1

innodb_buffer_pool_dump_at_shutdown = 1

innodb_data_file_path = ibdata1:12M:autoextend

innodb_thread_concurrency = 8

innodb_flush_log_at_trx_commit = 2

innodb_log_buffer_size = 20M

innodb_log_file_size = 128M

innodb_log_files_in_group = 3

#innodb_max_undo_log_size = 4G

innodb_io_capacity = 4000

innodb_io_capacity_max = 8000

innodb_flush_neighbors = 0

innodb_write_io_threads = 8

innodb_read_io_threads = 8

innodb_purge_threads = 4

innodb_open_files = 65535

innodb_max_dirty_pages_pct = 90

innodb_flush_method = O_DIRECT

innodb_lru_scan_depth = 4000

innodb_checksum_algorithm = crc32

innodb_lock_wait_timeout = 120

innodb_rollback_on_timeout = 1

innodb_print_all_deadlocks = 1

innodb_file_per_table = 1

innodb_online_alter_log_max_size = 4G

#internal_tmp_disk_storage_engine = InnoDB

[mysqldump]

quick

max_allowed_packet = 32M

mysql 5.6

1.下载合适版本(官网5.7,我们学习用5.1);免编译的二进制包。

2.解压 tar

3.创建运行mysql的账户 不需要登陆 可不创建家目录。useradd -s /sbin/nologin -M mysql

4.移动并重命名。mv mysql.......... /usr/local/mysql

5.查看mysql文件 ls /usr/local/mysql

6.进入 cd /usr/local/mysql

7.创建存放mysql数据的文件夹并更改权限 mkdir -p /data/mysql; chown -R mysql /data/mysql

7.初始化库 ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql; 初始化完成就有两个“ok”。也可以用命令 echo $? 检测,如果输出为0 表示成功。

8.将配置文件放在相应的目录里面。配置文件存放目录 cd support-files/ ;先将my-large.cnf拷贝到etc/my.cnf下并覆盖之前的配置文件: cp my-large.cnf etc/my.cnf。打开my-large.cnf:vim my-large.cnf。

9.拷贝启动脚本。加入到系统服务列表中并启动服务。[cp mysql.server /etc/init.d/mysqld];[vim !$ ; datadir=/data/mysql ];[chkconfig -add mysql ];[chkconfig mysql on ];[ /etc/init.d/mysqld start]

初始化

./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql

设置数据库密码

UPDATE user SET Password=PASSWORD('newpassword') where USER='root';

flush privileges;

开启远程登录

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

创建账号授权

CREATE USER 'xxx'@'%' IDENTIFIED BY '123456';

grant all privileges on xxx.* to 'xxx'@'%' identified by '123456' with grant option;

flush privileges;

创建uft-8的数据库

create database `xxx` character set utf8 collate utf8_general_ci;

导入数据

mysqldump -uroot -p > 20181105_dqws_pro.sql

[client]

port = 3306

socket = /tmp/mysql.sock

default-character-set = utf8mb4

[mysqld]

port = 3306

socket = /tmp/mysql.sock

basedir = /usr/local/mysql

datadir = /data/mysql/

#log_error = /data/mysql/hz-devops-test-02.err

#pid-file = /data/mysql/hz-devops-test-02.pid

tmpdir = /data/mysql/tmp

character-set-server = utf8

collation-server = utf8_general_ci

user = mysql

bind-address = 0.0.0.0

server_id = 107

#skip-networking

back_log = 600

thread_concurrency = 64

max_connections = 3000

max_connect_errors = 6000

open_files_limit = 65535

table_open_cache = 5120

max_allowed_packet = 512M

binlog_cache_size = 16M

max_heap_table_size = 4096M

tmp_table_size = 1024M

read_buffer_size = 16M

read_rnd_buffer_size = 32M

sort_buffer_size = 16M

join_buffer_size = 16M

key_buffer_size = 256M

thread_cache_size = 64

query_cache_size = 8M

query_cache_limit = 2M

ft_min_word_len = 4

log_bin = mysql-bin

binlog_format = mixed

expire_logs_days = 30

slow_query_log = 1

long_query_time = 1

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

performance_schema = 0

explicit_defaults_for_timestamp

#lower_case_table_names = 1

skip-external-locking

sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

default_storage_engine = InnoDB

#default-storage-engine = MyISAM

innodb_file_per_table = 1

innodb_open_files = 500

innodb_buffer_pool_size = 1G

innodb_write_io_threads = 8

innodb_read_io_threads = 8

innodb_thread_concurrency = 0

innodb_purge_threads = 1

innodb_flush_log_at_trx_commit = 1

innodb_log_buffer_size = 20M

innodb_log_file_size = 32M

innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 90

innodb_lock_wait_timeout = 120

bulk_insert_buffer_size = 32M

myisam_sort_buffer_size = 128M

myisam_max_sort_file_size = 10G

myisam_repair_threads = 1

interactive_timeout = 1800

wait_timeout = 1800

[mysqldump]

quick

max_allowed_packet = 512M

[myisamchk]

key_buffer_size = 256M

sort_buffer_size = 256M

read_buffer = 4M

write_buffer = 4M

log-bin = /data/mysql/mysql-bin

max_binlog_size = 500M

binlog-do-db=xxx

binlog-ignore-db=mysql

binlog_format = mixed

expire_logs_days = 30

sync_binlog = 1

binlog_checksum=crc32

######

relay_log =/data/mysql/log/relaylog

relay_log_index =/data/mysql/log/relay.index

relay_log_info_file =/data/mysql/log/relay-log.info

#####

# slave

slave_load_tmpdir =/data/mysql/tmp

slave_skip_errors = all

skip-slave-star

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值