当前位置:网站首页>On the machine where MySQL is started, configure the instance
On the machine where MySQL is started, configure the instance
2022-04-21 14:03:00 【daydayup9527】
It's starting mysql On the machine , Configure the instance
[root@node1 ~]# yum install -y libaio numactl-libs
[root@node1 ~]# mkdir -p /data/mysql
[root@node1 ~]# chown mysql.mysql /data/mysql
[root@node1 ~]# tar xf mysql-5.7.37-linux-glibc2.12-x86_64.tar.gz
[root@node1 ~]# mv mysql-5.7.37-linux-glibc2.12-x86_64 /usr/local/mysql
[root@node1 ~]# chown -R root.root /usr/local/mysql/
[root@node1 ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/data/mysql
[root@node1 ~]# grep password /data/mysql/mysql.log
2022-04-11T14:15:33.754322Z 1 [Note] A temporary password is generated for root@localhost: g3(ujLzfFi.f
[root@node1 ~]# cat /etc/my.cnf
[mysqld]
datadir=/data/mysql
socket=/data/mysql/mysql.sock
log-error=/data/mysql/mysql.log
pid-file=/data/mysql/mysql.pid
skip_name_resolve = 1
[client]
socket=/data/mysql/mysql.sock
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
[root@node1 ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@node1 ~]# chkconfig --add mysqld
[root@node1 ~]# service mysqld start
[root@node1 ~]# /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/error.log --open-files-limit=65535 --pid-file=mysqldb.pid --socket=/data/mysql/mysql.sock --port=3306 &
[root@node1 ~]# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
mysql> alter user root@localhost identified by "123456";
mysql> flush privileges;
mysql> create database test1;
mysql> exit
Start the second instance
Because it failed to restart mysql service , Start using this time root start-up
[mysqld_multi]
mysqld = /usr/local/mysql /bin/mysqld_safe
mysqladmin = /usr/local/mysql/bin/mysqladmin
log = /data/mysql/mysqld_multi.log
[mysqld]
datadir=/data/mysql
socket=/data/mysql/mysql.sock
log-error=/data/mysql/mysql.log
pid-file=/data/mysql/mysql.pid
skip_name_resolve = 1
[client]
socket=/data/mysql/mysql.sock
[mysqld3307]
skip-grant-tables // Because the password was not found . Let's skip here
user=root // The startup here is changed to root
mysqld=mysqld
mysqladmin=mysqladmin
datadir=/data/mysql2
port=3307
server_id=3307
socket=/tmp/mysql_3307.sock
log-output=file
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /data/mysql2/slow.log
log-error = /data/mysql2/error.log
binlog_format = mixed
log-bin = /data/mysql2/mysql3307_bin
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
[root@node1 ~]# export PATH=/usr/local/mysql/bin:$PATH
[root@node1 ~]# /usr/local/mysql/bin/mysqld_multi start 3307
[root@node1 ~]# ss -antup | grep 3307
tcp LISTEN 0 80 [::]:3307 [::]:*
[root@node1 ~]# mysql -S /tmp/mysql_3307.sock -p
mysql> set password for root@localhost = password('654321');
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> set password for root@localhost = password('654321');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> exit
[root@node1 ~]# mysql -S /mysql/data/mysql.sock -p123456 -e "show databases;"
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test1 |
+--------------------+
[root@node1 ~]# mysql -S /tmp/mysql_3307.sock -p654321 -e "show databases;"
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
版权声明
本文为[daydayup9527]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211351296807.html
边栏推荐
- pytorch geometric中为何要将稀疏邻接矩阵写成转置的形式adj_t
- The common interface of priority queue (heap) introduces the storage of heap and the creation of heap
- 基于word2vec的k-means聚类
- Chapter II commercial password application and security evaluation policies and regulations on commercial password application and security evaluation - Summary of deleted version
- MySQL storage engine
- Zabbix5 series - monitoring redis (XI)
- Notes d'examen triées
- MySQL主从同步-多实例
- 对机器学习的理解
- Dual homing uplink - active / standby / load
猜你喜欢

Chapter III commercial password standards and product applications of commercial password application and security evaluation - Summary

让别人连接自己的mysql数据库,共享mysql数据库

< 2021SC@SDUSC > Application and practice of software engineering in Shandong University jpress code analysis (10)

报错:ModuleNotFoundError: No module named ‘astra‘

Emergency response notes

EsgynDB CQD-traf_ lock_ ddl

The importance of computing edge in Networkx: edge intermediate number or intermediate centrality edge_ betweenness

恭喜 EDG 勇夺 2021 英雄联盟全球总决赛冠军

networkx计算边的重要性:边介数或者中介中心性edge_betweenness

iscsi
随机推荐
pytorch机器学习之numpy基础
Getting started with redis
Zabbix5系列-监控redis (十一)
Campus network architecture
SQL injection vulnerability shooting range - sqli labs learning
优先级队列 (堆)常用接口介绍 堆的存储 堆的创建
ceph多monitor实现高可用
The stack concept is transformed into cyclic bracket matching inverse Polish expression simulation to achieve full dry goods
终止线程使用interrupt
Trim function of esgyndb
函数单调性与凹凸性
Zabbix5 series - sound alarm, mail alarm (XIV)
web课程设计-照片记录网站(Flask)
FTP service
centos 离线安装mysql
SQL注入之sqli-labs等(安装,配置)
stm32笔记
<2021SC@SDUSC>山东大学软件工程应用与实践JPress代码分析(六)
Cdh5 delete data node
Zabbix5 series - report tool zbxtable (XVIII)