Skip to content

Instantly share code, notes, and snippets.

@Linuxpizi
Linuxpizi / mysql主从.md
Last active April 1, 2020 09:57
mysql主从搭建步骤
  1. 主节点创建账号
  -- 更新初始账号
  -- update mysql.user set password=password('ucloud.cn') where host='127.0.0.1' and user='root';
  -- flush privileges;
  -- 创建主从账号 192.168.179.1是从节点的IP
  create user 'repl'@'10.93.123.15' identified by 'ucloud.cn';
  grant replication slave on *.* to 'repl'@'192.168.179.1';
  flush privileges;
@Linuxpizi
Linuxpizi / mysqld.service
Created March 31, 2020 02:58
mysqld systemed 配置
[Unit]
Description=MySQL Server
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
Alias=mysql.service
[Service]
@Linuxpizi
Linuxpizi / my.cnf
Created March 31, 2020 02:57
mysql配置
[client]
port = 3306
socket = /var/lib/mysql/mysql.sock
[mysql]
no-auto-rehash
[mysqld]
#Misc
server-id = 1
user = mysql
@Linuxpizi
Linuxpizi / sleep.js
Created August 12, 2019 12:58
add js sleep function
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
sleep(2000).then(() => console.log("over"))
@Linuxpizi
Linuxpizi / error_stack.go
Created August 5, 2019 07:34
add error imp to track error stack show where error (file,line and date)
package uError
import (
"fmt"
"runtime"
)
// LError ..
type LError struct {
errors []error