赞
踩
下载版本: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
(以下方式不使用mysql默认的路径/usr/local/mysql;使用自定义路径)
1、初始化数据库:
./mysql_install_db --user=jfshop --basedir=/app/soft/Percona-Server-5.7.11 --datadir=/app/soft/perdata
启动mysql数据库
./mysqld --defaults-file=/app/soft/conf/my.cnf --basedir=/app/soft/Percona-Server-5.7.11
登陆数据库
./mysql -u root -p --socket=/app/soft/log/per.sock
补充:
如果直接使用命令./mysql -u root -p
mysql默认会找/tmp/mysql.sock
因此若是为了方便可以在my.cnf中直接这样写socket= /tmp/mysql.sock
my.cnf文件的最后添加一下内容跳过密码验证
skip-grant-tables
进入mysql面板后修改密码:
UPDATE user SET Password = PASSWORD('password') WHERE user = 'root';
修改以后删除my.cnf 中的跳过验证
重启mysql服务
进入mysql面板后需进行一下操作:
ALTER USER USER() IDENTIFIED BY 'password';
自定义目录下的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
修改mysql使其允许被远程访问:
root用户的 host 属性 改为 % 即可
刷新权限:
flush privileges ;
将文件系统复制到PC机上,然后再拷贝到别的SD卡后,发现mysql无法启动了,首先检查了一下mysql的错误日志,发现最后出现以下错误:
/usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
提示./mysql-bin.index无法找到(由于mysql开启了bin日志功能),到数据库根目录查看该文件是存在的,可能是文件权限的问题,查看了数据库根目录的权限是700,所有者和用户组都是root,可能是上次转移数据库的时候不小心修改了文件夹的权限。
解决方法:
chgrp -R mysql /app/soft/log && chown -R mysql /app/soft/log
重新启动mysql [OK]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。