mysql -uroot-p
CREATE USER'mjq2'@'%' IDENTIFIED WITH mysql_native_password BY '123';# 创建账号mjq@%, 密码123
GRANT REPLICATION SLAVE ON *.* TO 'mjq2'@'%';# 为用户 mjq@% 分配主从复制权限# select Repl_slave_priv from user where user='mjq2'; # 理应为Y
flush PRIVILEGES;
查看当前主库二进制日志坐标
show master status; # 从库连接后需要从记录的坐标开始复制
# 查询到 File :mysql-bin.000007 Position:4074
ubuntu20.04:mysql从库
sudovim /etc/mysql/mysql.conf.d/mysqld.cnf
# 修改完毕重启sudoservice mysql stop
sudoservice mysql start
从库mysqld.cnf配置
[mysqld]
server-id=140#[必须]服务器唯一ID(唯一即可)
进入mysql配置从库复制信息
change master to master_host='192.168.137.139',master_user='mjq2',master_password='123',master_log_file='mysql-bin.000007',master_log_pos=4074; # 连接主库 File :mysql-bin.000007 Position:4074
start slave; # 启动从库复制
show slave status; # 查询主从复制状态,Slave_IO_Runnig和Slave_SQL_Running都要为Yes
栈和队列
1. 用两个栈实现队列
原题链接
补充:copy(a,b) 把a赋值给b class MyQueue {
public:/** Initialize your data structure here. */stack<int> stk, cache;MyQueue() {}/** Push element x to the back of queue. */void push(int x) {stk.push(x)…
点击vscode插件 --> 点击3个点 --> 选择从VSIX安装 点击更新报 Cannot update while running on a read-only volume. The application is on a read-only volume. Please move the application and try again. If you’re on macOS Sierra or later, you’ll need to m…