当前位置:   article > 正文

Linux主机Percona5.7.11安装(直接解压初始化方式)_ubuntu apt percona-server-5.7

ubuntu apt percona-server-5.7

主机Percona安装(直接解压初始化方式)

下载版本:Percona-Server-5.7.11-4-Linux.x86_64.ssl101.tar.gz
解压:

	tar -zxvf Percona-Server-5.7.11-4-Linux.x86_64.ssl101.tar.gz
  • 1

(以下方式不使用mysql默认的路径/usr/local/mysql;使用自定义路径)

前提条件:确保创建有效的basedir,datadir,socket路径目录

1、初始化数据库:

./mysql_install_db --user=jfshop --basedir=/app/soft/Percona-Server-5.7.11 --datadir=/app/soft/perdata
  • 1

启动mysql数据库

./mysqld --defaults-file=/app/soft/conf/my.cnf --basedir=/app/soft/Percona-Server-5.7.11
  • 1

登陆数据库

./mysql -u root -p --socket=/app/soft/log/per.sock
  • 1

补充:
如果直接使用命令./mysql -u root -pmysql默认会找/tmp/mysql.sock因此若是为了方便可以在my.cnf中直接这样写socket= /tmp/mysql.sock


my.cnf文件的最后添加一下内容跳过密码验证

skip-grant-tables
  • 1

进入mysql面板后修改密码:

UPDATE user SET Password = PASSWORD('password') WHERE user = 'root';
  • 1

修改以后删除my.cnf 中的跳过验证
重启mysql服务
进入mysql面板后需进行一下操作:

ALTER USER USER() IDENTIFIED BY 'password';
  • 1

自定义目录下的my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
user = jfshop
basedir = /app/soft/Percona-Server-5.7.11
datadir = /app/soft/perdata
port = 3306
server_id = 63306
socket = /app/soft/log/per.sock
log-bin = /app/soft/log/mysql-bin.log
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32

修改mysql使其允许被远程访问:

	root用户的 host 属性 改为 %  即可
  • 1

刷新权限:

flush privileges ;
  • 1
‘./mysql-bin.index’ not found (Errcode: 13) 的解决方法

将文件系统复制到PC机上,然后再拷贝到别的SD卡后,发现mysql无法启动了,首先检查了一下mysql的错误日志,发现最后出现以下错误:

/usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
  • 1

提示./mysql-bin.index无法找到(由于mysql开启了bin日志功能),到数据库根目录查看该文件是存在的,可能是文件权限的问题,查看了数据库根目录的权限是700,所有者和用户组都是root,可能是上次转移数据库的时候不小心修改了文件夹的权限。
解决方法:

chgrp -R mysql /app/soft/log && chown -R mysql /app/soft/log
  • 1

重新启动mysql [OK]

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/877154
推荐阅读
相关标签
  

闽ICP备14008679号