mysql-5.7.21 二进制包安装
简介mysql-5.7.21 二进制包安装
二进制包默认安装地址:/usr/local/mysql 所以以下的操作都需要明确这一点,也可以修改,但是在处理其他方面就需要多花时间
mysql5.7.7及以上做了很多改变,5.7.7以前安装方法和以前差不多,初始化也保留了mysql_install_db,5.7.7以后则去掉了该脚本,使用了-initialize或者 --initialize-insecure 参数作为初始化
下面我们完全个性化自定义安装:
一、初始化
1、下载二进制包:mysql-5.7.21-linux-glibc2.12-x86_64.tar
下载地址:https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-linux-glibc2.12-x86_64.tar
2、将包解压:
tar xv mysql-5.7.21-linux-glibc2.12-x86_64.tar
解压后:
mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
mysql-test-5.7.21-linux-glibc2.12-x86_64.tar.gz
3、解压mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz到指定的目录
tar xf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz -C /apps/
4、修改目录名称
mv mysql-5.7.21-linux-glibc2.12-x86_64 mysql-5.7.21
5、建立软连接
ln -s mysql-5.7.21 mysql
6、添加用户组和用户
groupadd mysql
useradd -g mysql -s /sbin/nologin mysql
7、授权
chown -R mysql.mysql mysql-5.7.21
chown -R mysql.mysql mysql
注意:如果配置多实例的话,安装到本步骤即可,就不用往下进行,如果单实例就继续
8、在/etc目录下创建my.cnf文件,内容如下:(配置文件有待验证)
[client]
port = 3307
socket = /apps/mysql/mysql.sock
[mysqld]
server_id=10
port = 3307
user = mysql
character-set-server = utf8mb4
default_storage_engine = innodb
log_timestamps = SYSTEM
socket = /apps/mysql/mysql.sock
basedir = /apps/mysql
datadir = /apps/mysql/data
pid-file = /apps/mysql/mysql.pid
max_connections = 1000
max_connect_errors = 1000
table_open_cache = 1024
max_allowed_packet = 128M
open_files_limit = 65535
explicit_defaults_for_timestamp=true
#####[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 = /apps/mysql/log/mysql-error.log
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
9、初始化数据库
./bin/mysqld --defaults-file=/apps/mysql/conf/my.cnf --initialize --datadir=/apps/mysql/data/ --basedir=/apps/mysql --user=mysql
执行完后:
2018-04-17T19:34:34.945648Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-17T19:34:35.306554Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-04-17T19:34:35.689074Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-04-17T19:34:35.999760Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 5c7be431-4276-11e8-beef-000c295f4e30.
2018-04-17T19:34:36.004881Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-04-17T19:34:36.006748Z 1 [Note] A temporary password is generated for root@localhost:#EnZtrwNq9e3
上面就是默认密码
初始化时候使用的–initialize-insecure参数,不会随机生成密码,登录和原来一样
10、查看帮助信息:
bin/mysqld --verbose --help | more
二、启动mysql实例
1、初始化完成后,就开始准备启动,启动还保持着原来的方式,可以使用mysqld_safe启动,所以参数基本差不多。mysqld_safe启动也是推荐的方式。
./bin/mysqld_safe --defaults-file=/apps/mysql/conf/my.cnf --datadir=/apps/mysql/data/ --basedir=/apps/mysql --user=mysql &
2、本地必须使用socket连接:
bin/mysql -S /apps/mysql/mysql.sock -P3307 -uroot -p
回车输入密码
3、首次进入需要先重置密码,不然操作会提示:
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
4、重置密码:
set password=password('123456');
以上配置就基本完成
错误:
1、mysqld_safe error: log-error set to ‘/apps/mysql/log/mysql-error.log’, however file don’t exists. Create writable for user ‘mysql’.
解决:
echo "" > /apps/mysql/log/mysql-error.log
chown -R mysql.mysql /apps/mysql/log/mysql-error.log
图像添加(高斯/椒盐/泊松/斑点)噪声
nodejs中使用npm和yarn,使用最新阿里云镜像 aliyun mirror,网上很多还是文章用的是下面这个地址~~yarn config set registry https://registry.npm.taobao.org~~
《是妈妈是女儿》聚焦母女间未曾言明的爱意,以书信对话的形式呈现出各自的内心独白,表达彼此的牵挂。黄绮珊与希林娜依·高用跨越时空、打开心扉、深情对唱的形式,将天下母女爱的寄语化作心灵的倾诉。黄绮珊的每一句话,每一个字都演绎出了妈妈对女儿的爱,而希林依娜·高把女儿对妈妈的爱由不理解到理解再到感恩演绎得淋漓尽致。
Go-Micro微服务装饰器wrapper使用
Mysql的二进制文件是非常重要的,那么我们如何查看二进制文件的信息呢?本文主要介绍两种方式:在登录后的会话中查看和使用mysqlbinlog命令查看。
快速生成表格
Electron页面跳转、浏览器打开链接和打开新窗口
在使用Git的过程中,不想每次都输入用户名和密码去拉取代码,所以就需要保存这些信息,那么既然有保存了,就必须有清除功能。
Docker编译镜像出现:fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.12/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.2c4ac24e.tar.gz: No such file or directory问题
在Mac电脑中,如何对Git的用户名和密码进行修改呢?起初不懂Mac,所以整了很久,本文将记录如何对这个进行操作,以便后期使用。