这篇文章主要讲解了“普通二进制文件安装mysql5.7.16的步骤”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“普通二进制文件安装mysql5.7.16的步骤”吧!
centos6.5 x64
安装如下rpm:
yum list | grep libaio #安装所有包
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
cd /usr/local
tar zxvf ~/mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
ln -s mysql-5.7.16-linux-glibc2.5-x86_64 mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld # config auto start service,optional
cd /usr/local/mysql
mkdir /usr/local/mysql/mysql-files
chmod 750 mysql-files
chown -R mysql .
chgrp -R mysql .
echo 'export PATH=$PATH:/usr/local/mysql/bin' >> ~/.bash_profile
source ~/.bash_profile
bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up ,---未生成data目录
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data #--ylrK.ea!o3os
bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up
chown -R root .
chown -R mysql data mysql-files
bin/mysqld_safe --user=mysql & #启动数据库
#---报错1如下:mysql自动报错
#----------------------------------------------------
2016-12-11T12:35:54.907157Z mysqld_safe Logging to '/var/log/mysqld.log'.
2016-12-11T12:35:54.972890Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2016-12-11T12:35:55.381863Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
##---/var/log/mysqld.log
2016-12-11T12:35:55.369838Z 0 [ERROR] /usr/local/mysql/bin/mysqld: Cant create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory)
2016-12-11T12:35:55.369865Z 0 [ERROR] Can't start server: can't create PID file: No such file or directory
2016-12-11T12:35:55.381863Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
# 解决方式1
mkdir /var/run/mysqld/
cd /var/run/
chown -R mysql.mysql mysqld
mysqld_safe --user=mysql &
#解决问题
#----------------------------------------------------
#---报错2如下
#----------------------------------------------------
/etc/init.d/mysqld status
ERROR! MySQL is running but PID file could not be found
# 解决方式1
# 重启
kill -9 <>
/etc/init.d/mysqld start
#解决问题
#----------------------------------------------------
#---报错3如下:初始登陆报错
#----------------------------------------------------
# mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Cant connect to local MySQL server through socket '/tmp/mysql.sock' (2)
# 解决方式1
#将配置文件/etc/my.cnf 做如下变更:
socket=/var/lib/mysql/mysql.sock --> socket=/tmp/mysql.sock
#未解决问题
# 解决方式2
在解决方式1的基础上:
停止mysql: kill -9 <>
运行mysqld_safe --skip-grant-tables &
如果此时不想被远程连接:mysqld_safe --skip-grant-tables --skip-networking &
使用mysql连接server:mysql -uroot -p
更改密码: update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
*特别提醒注意的一点是,新版的mysql数据库下的user表中已经没有Password字段了
而是将加密后的用户密码存储于authentication_string字段
mysql> flush privileges;
mysql> quit;
修改完毕。重启
killall -TERM mysqld。
mysqld_safe &
#解决问题
#----------------------------------------------------
感谢各位的阅读,以上就是“普通二进制文件安装mysql5.7.16的步骤”的内容了,经过本文的学习后,相信大家对普通二进制文件安装mysql5.7.16的步骤这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。