Percona Server for MySQL安装

举报
snowofsummer 发表于 2021/02/05 11:22:06 2021/02/05
【摘要】 下载地址:https://www.percona.com/downloads/Percona-Server-5.7/LATEST/手动初始化,建立数据库1,配置my.cnfuseradd mysql mkdir /3306mkdir /3306/datamkdir /3306/logmkdir /3306/runtouch /3306/log/db.logchown -R mysql:mys...

下载地址:

https://www.percona.com/downloads/Percona-Server-5.7/LATEST/

手动初始化,建立数据库




1,配置my.cnf
useradd mysql 
mkdir /3306
mkdir /3306/data
mkdir /3306/log
mkdir /3306/run
touch /3306/log/db.log
chown -R mysql:mysql /3306

cat >> /3306/my.cnf<<EOF
[mysqld]
port=3306
datadir=/3306/data
socket=/3306/mysql.sock
[mysqld_safe]
log-error=/3306/log/db.log
pid-file=/3306/run/db.pid
EOF


2,初始化数据库
# 生产随机初始化密码
/home/percona-5.7.17/bin/mysqld --defaults-file=/3306/my.cnf   --initialize  --user=mysql

2021-02-05T02:06:41.561705Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-02-05T02:06:41.561899Z 0 [ERROR] Can't find error-message file '/data/home/jenkins/jobs/626/workspace/dev/percona-5.7.17/mysql_install/percona-server-5.7.17/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2021-02-05T02:06:41.803872Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-02-05T02:06:41.837373Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-02-05T02:06:41.895651Z 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: ca02b854-6756-11eb-806a-000c29a91aed.
2021-02-05T02:06:41.896297Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-02-05T02:06:41.897039Z 1 [Note] A temporary password is generated for root@localhost: !79VH4Er2R3.《===随机密码

#默认没有密码
/home/percona-5.7.17/bin/mysqld --defaults-file=/3306/my.cnf  --user=mysql --initialize-insecure

2021-02-05T02:21:41.078948Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-02-05T02:21:41.079132Z 0 [ERROR] Can't find error-message file '/data/home/jenkins/jobs/626/workspace/dev/percona-5.7.17/mysql_install/percona-server-5.7.17/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2021-02-05T02:21:41.272836Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-02-05T02:21:41.305158Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-02-05T02:21:41.313561Z 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: e21b0076-6758-11eb-b9a1-000c29a91aed.
2021-02-05T02:21:41.314075Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-02-05T02:21:41.314521Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.




3,启动数据库
启动失败?
[root@db01 percona-5.7.17]# /home/percona-5.7.17/bin/mysqld_safe --defaults-file=/3306/my.cnf&
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
grep: write error: Broken pipe
2021-02-05T02:08:08.137834Z mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
2021-02-05T02:08:08.141162Z mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
2021-02-05T02:08:08.144423Z mysqld_safe The file /data/home/jenkins/jobs/626/workspace/dev/percona-5.7.17/mysql_install/percona-server-5.7.17/bin/mysqld
does not exist or is not executable. Please cd to the mysql installation
directory and restart this script from there as follows:
./bin/mysqld_safe&
See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more informatio


解决方法?
1,建立软连接?
ln -s /home/percona-5.7.17/bin/mysqld /data/home/jenkins/jobs/626/workspace/dev/percona-5.7.17/mysql_install/percona-server-5.7.17/bin/mysqld
#成功启动。
[root@db01 percona-5.7.17]# /home/percona-5.7.17/bin/mysqld_safe --defaults-file=/3306/my.cnf&

2021-02-05T02:38:16.937782Z mysqld_safe Logging to '/3306/log/db.log'.
2021-02-05T02:38:16.970741Z mysqld_safe Starting mysqld daemon with databases from /3306/data

2,进入percona-5.7.17/bin 上级目录里执行就可以成功启动?
cd /home/percona-5.7.17
pwd
/home/percona-5.7.17
./bin/mysqld_safe  --defaults-file=/3306/my.cnf&

2021-02-05T02:38:16.937782Z mysqld_safe Logging to '/3306/log/db.log'.
2021-02-05T02:38:16.970741Z mysqld_safe Starting mysqld daemon with databases from /3306/data



4,测试数据库
[root@db01 percona-5.7.17]# mysql -uroot  -S /3306/mysql.sock -e "show databases;"
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+









【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。