在/etc/mysql/文件夹中找,可以找到上图信息的.cnf的文件,注释后保存;
/my.cnf |grep mysql3306 socket = /usr/local/mysql3306/var/mysql.sock socket = /usr/local/mysql3306/var.../mysql.sock basedir = /usr/local/mysql3306/ datadir = /data/mysql3306/data pid-file = /data/mysql3306.../data/mysql.pid log_error = /data/mysql3306/data/mysql-error.log slow_query_log_file = /data/mysql3306.../bin/mysqld_safe --datadir=/data/mysql3306/data --pid-file=/data/mysql3306/data/mysql.pid & [root@radius01...2)部署主从复制环境 先在主库上操作: [root@radius01 ~]# /usr/local/mysql3306/bin/mysql -p123456 -S /usr/local/mysql3306
mkdir -p /mysql/app/ mkdir -p /mysql/conf/ mkdir -p /mysql/data/mysql3306/pid/ mkdir -p /mysql/data/...mysql3306/socket/ mkdir -p /mysql/data/mysql3306/log/ mkdir -p /mysql/data/mysql3306/binlog/ mkdir -p.../mysql/data/mysql3306/errlog mkdir -p /mysql/data/mysql3306/relaylog/ mkdir -p /mysql/data/mysql3306.../data/ socket=/mysql/data/mysql3306/socket/mysql.sock log-error=/mysql/data/mysql3306/log/mysqld.log...= /mysql/data/mysql3306/binlog/mysql_bin log_bin_index = /mysql/data/mysql3306/binlog/mysql_binlog.index
/mysql3306/pid/ mkdir -p /mysql/data/mysql3306/socket/ mkdir -p /mysql/data/mysql3306/log/ mkdir -p /...mysql/data/mysql3306/binlog/ mkdir -p /mysql/data/mysql3306/relaylog/ mkdir -p /mysql/data/mysql3306/...datadir=/mysql/data/mysql3306/data/ socket=/mysql/data/mysql3306/socket/mysql.sock log-error=/mysql/.../mysql3306/log/mysqld.log --pid-file=/mysql/data/mysql3306/pid/mysqld.pid --socket=/mysql/data/mysql3306.../mysql3306/errlog/err3306.log --pid-file=/mysql/data/mysql3306/pid/mysqld.pid --socket=/mysql/data/mysql3306
创建目录并授权 在data根目录下执行 mkdir -p mysql3306/data mysql3306/mysql_log mysql3306/tmp mysql3307/data mysql3307...touch /data/mysql3306/mysql_log/mysql3306.err touch /data/mysql3307/mysql_log/mysql3307.err 赋予目录和文件权限...= /data/mysql3306/mysql_log/mysql3306.pid slow_query_log_file= /data/mysql3306/mysql_log/mysql3306_slow_new.log... log-error = /data/mysql3306/mysql_log/mysql3306.err general_log_file= /data/mysql3306/mysql_log/mysql3306....genlog log-bin = /data/mysql3306/mysql_log/mysql3306_bin relay_log= /data/mysql3306/mysql_log/relay3306
/mysql3306/data/ mkdir -p /mysql/data/mysql3306/pid/ mkdir -p /mysql/data/mysql3306/socket/ mkdir -p.../mysql/data/mysql3306/log/ mkdir -p /mysql/data/mysql3306/binlog/ mkdir -p /mysql/data/mysql3306/relaylog.../ mkdir -p /mysql/data/mysql3306/slowlog/ mkdir -p /mysql/data/mysql3306/tmp/ mkdir -p /mysql/data/.../data/ socket = /mysql/data/mysql3306/socket/mysql3306.sock pid_file = /mysql/data/mysql3306/pid/mysqld3306...= /mysql/data/mysql3306/binlog/mysql_bin log_bin_index = /mysql/data/mysql3306/binlog/mysql_binlog.index
/{mysql,binlog,slowlog,tmp,log,run,conf} chown -R mysql:mysql /data/mysql3306 chown -R mysql:mysql /usr...: [client] port = 3306 socket =/data/mysql3306/run/mysql.sock [mysql] prompt="\u...@node01\R:\m:\s [\d]> " # XXXX主机名 no-auto-rehash socket=/data/mysql3306/run/mysql.sock [mysqld] #.../binlog/mysql-relay-bin ####: for error-log log_error =/data/mysql3306/log.../conf/my.cnf --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql3306/mysql # 配置
http://downloads.mysql.com/archives/community/ 路径要求: 数据库文件安装目录: /usr/local/mysql 数据目录: /data/mysql/mysql3306...目录 含义 配置参数 data 用于存储数据 datadir tmp 用于存储临时文件 tmpdir log 日志文录 log_bin_basename mkdir -p /data/mysql/mysql3306.../{data,log,tmp} chown -R mysql:mysql /data/mysql/mysql3306 9 将 MySQL 配置文件 my.cnf 放置到/etc/my.cnf 默认情况下...DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/data/mysql/mysql3306.../bin/mysqld --initialize 获取初始化的密码: cat /data/mysql/mysql3306/data/error.log |grep password 利用这个 password
1、案例还原 1.1 创建目录并创建授权 处理完成后,权限如下 1.2 安装数据库 bin/mysqld --defaults-file=/data/mysql/mysql3306/etc/my.cnf...--initialize --user=mysql 此时报错信息如下: mysqld: Can't change dir to '/data/mysql/mysql3306/data/' (Errcode...existing data directory. 2022-10-29T19:02:30.100460+08:00 0 [ERROR] failed to set datadir to /data/mysql/mysql3306...1.4 问题解决 修改目录权限为755 chmod 755 mysql/ 再进行初始化 bin/mysqld --defaults-file=/data/mysql/mysql3306/etc/my.cnf...initialize --user=mysql 顺利完成初始化 启动数据库,成功 /usr/local/mysql5.7/bin/mysqld_safe --defaults-file=/data/mysql/mysql3306
/data tmpdir = /data/mysql3306/tmp socket = /data/mysql3306/data/mysql.sock pid-file = netdatdb01-137.../slow.log log-error = /data/mysql3306/error.log long_query_time = 0.1 log_queries_not_using_indexes =...{start|stop|restart}\n" esac chmod a+x /data/scripts/mysql3306 11.启动服务 /data/scripts/mysql3306 start...12.修改密码 mysql -uroot -p -S /data/mysql3306/data/mysql.sock alter user user() identified by "netdata"...14.设置环境变量 echo "alias mysql3306='mysql --login-path=3306_root --defaults-file=/data/conf/my3306.cnf
相关包升级附在文末创建相关目录 mkdir /usr/local/mysql mkdir -p /data/mysql/mysql3306/{data,logs,tmp,etc}2.2 编译阶段开始编译...cmake -DINSTALL_PREFIX=/usr/local/mysql \-DMYSQL_DATADIR=/data/mysql/mysql3306/data \-DMYSQL_UNIX_ADDR...=/data/mysql/mysql3306/tmp/mysql.sock \-DMYSQL_TCP_PORT=3306 \-DWITH_INNODB_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS...-DFORCE_INSOURCE_BUILD=1 再编译一次cmake -DINSTALL_PREFIX=/usr/local/mysql \-DMYSQL_DATADIR=/data/mysql/mysql3306...安装数据库创建数据库相关目录及配置文件 mkdir -p /data/mysql/mysql3306/{data,logs,tmp,etc}配置文件按需添加放在etc/my.cnf中创建mysql用户并将数据库目录授权
S 2023 0:00 /bin/sh /usr/local/mysql5.7/bin/mysqld_safe --defaults-file=/data/mysql/mysql3306/etc...Sl 2023 120:07 /usr/local/mysql5.7/bin/mysqld --defaults-file=/data/mysql/mysql3306/etc/my.cnf --basedir...=/usr/local/mysql5.7 --datadir=/data/mysql/mysql3306/data --plugin-dir=/usr/local/mysql5.7/lib/mysql/...=/data/mysql/mysql3306/tmp/mysqld.pid --socket=/data/mysql/mysql3306/tmp/mysql.sock --port=3306 结果中有...--defaults-file=/data/mysql/mysql3306/etc/my.cnf,即该实例所使用的配置文件信息。
service mysqld1 start service mysqld2 start ...... service mysqldn start 实现方式如下: # mkdir -p /home/mysql3306...# mkdir -p /home/mysql3307 # mkdir -p /home/mysql3308 # chown -R mysql:mysql /home/mysql3306 #.../mysql3308 # /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir= /home/mysql3306...mysql --datadir= /home/mysql3308 --user=mysql # cp /usr/local/mysql/support-files/my-huge.cnf /home/mysql3306...basedir= datadir=/home/mysql3306/data/ # Default value, in seconds, afterwhich the script should timeout
创建mysql账户和数据目录 # 创建用户 groupadd mysql useradd -r -g mysql -s /bin/false mysql # 创建数据目录 mkdir -p /data/mysql3306.../data/mysql3306 chown -R mysql....=$PATH:/usr/local/mysql/bin" >> /etc/profile source /etc/profile # 初始化 mysqld --defaults-file=/data/mysql3306.../config/my.cnf --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql3306/mysql #...配置ssl mysql_ssl_rsa_setup --basedir=/usr/local/mysql --datadir=/data/mysql3306/mysql # 手动启动 mysqld_safe
/logs/mysql-bin # 不写路径默认在目录下 relay-log=/data/mysql3306/logs/relay-log # 不写路径默认在目录下 skip-name-resolve...Opening /data/mysql3306/data/relay-log.info ... ok....Opening /data/mysql3306/data/relay-log.info ... ok....Opening /data/mysql3306/data/relay-log.info ... ok....Opening /data/mysql3306/data/relay-log.info ... ok.
Leader:10.0.0.152 5.2、数据库重建 5.2.1、模拟删除主库数据目录 这是我的实验操作,生产环境谨慎这样操作 [root@mysql-152 ~]# cd /data/mysql/mysql3306...[root@mysql-152 mysql3306]# rm -rf data # kill 掉mysql 进程,我这里的数据库进程号是4718和6074 [root@mysql-152 mysql3306...]# kill -9 4718 6074 # 查看以下 vip 信息 和 集群状态信息,是否正常切换 [root@mysql-152 mysql3306]# ip addr show | grep 10.0.0.150...从上图得知:Leader: 10.0.0.151 5.2.2、进行数据库重建 [root@mysql-152 mysql3306]# su - mysql [mysql@mysql-152 ~]$ cd.../data/xenon/bin/ # 进行重建 [mysql@mysql-152 bin]$ mkdir /data/mysql/mysql3306/data [mysql@mysql-152 bin
192.168.37.219 #源实例ip sport=3306 #源实例端口 suser=root #源实例用户名 spassword=xxxx@123edc #源实例密码 sdatadir=/data/mysql/mysql3306...#目标实例ip dport=3306 #目标实例端口 duser=root #目标实例用户 dpassword=xxxx@123edc #目标实例密码 ddatadir=/data/mysql/mysql3306...txt #源实例信息配置 shost=192.168.37.219 sport=3306 suser=root spassword=xxxx@123edc sdatadir=/data/mysql/mysql3306...mysql #目标实例信息配置 dhost=192.168.169.40 dport=3306 duser=root dpassword=xxxx@123edc ddatadir=/data/mysql/mysql3306
copy-back 这里就开始copy备份文件到即将要还原备份的地方,这里需要提交配置好即将还原备份的cnf文件 # innobackupex --defaults-file=/data/mysql/mysql3306...26092718/ # chown -R mysql:mysql /data/ 3.5 启动 /usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/mysql3306
/mysql -R mkdir -p /data/mysql3306/data chown mysql.mysql /data/mysql3306/ -R mysql/bin/mysqld --initialize...--user=mysql --basedir=/opt/mysql/ --datadir=/data/mysql3306/data (注:这时候会显示出root的默认密码,需要记录下来) #记录初始化...webserver/mysql/support-files/mysql.server start /usr/local/webserver/mysql/bin/mysql -uroot -p -S/data/mysql3306...sort_buffer_size = 2M # read_rnd_buffer_size = 2M basedir = /usr/local/webserver/mysql datadir = /data/mysql3306...#socket = /data/mysql3306/mysql3306.sock pid-file = /data/mysql3306/mysql.pid max_connections=200 key_buffer_size
/etc/my.cnf --socket=/app/data/mysql3306/tmp/mysql.sock --port=3306 --user=backup --password='Backup.../* gzip方式压缩 */ /root/xtrabackup/bin/innobackupex --defaults-file=/app/data/mysql3306/etc/my.cnf...因此可以采用xbstream方式进行备份,备份命令如下: /root/xtrabackup/bin/innobackupex --defaults-file=/app/data/mysql3306/etc...incremental-basedir参数内容指定为上一次增量备份的目录即可 /root/xtrabackup/bin/innobackupex --defaults-file=/app/data/mysql3306...mkdir -p /app/data/mysql3307/{data,logs,tmp,etc} /* 生产配置文件 ,本次直接拷贝其他实例的配置文件 修改对应端口等*/ cp /app/data/mysql3306
领取专属 10元无门槛券
手把手带您无忧上云