使用YUM在Linux(CentOS 7)下安装mysql 5.7.18的教程详解
16lz
2021-12-31
项目需要使用MySQL,由于以前都是在windows下傻瓜式安装,基本没有遇到什么问题,但是这次是在服务器上安装,由于到Linux上安装软件不熟悉,走了不少弯路,耽误了好多时间。总结下来,以免下次再走弯路。
****************************图片插入不成功,不知道是怎么回事*********************************
一、各种环境:
linux版本:CentOS Linux release 7.2.1511 (core)
mysql版本:community sercer 5.7.18
使用的yum安装包:
Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package 25.1K Download(mysql57-community-release-el7-11.noarch.rpm)
我是先在windows上下载安装包,然后通过xshell导入到服务器中。然后根据mysql官网上的步骤安装的。任何教程都没有官网上的靠谱,之前在网上搜了好多教程,每个教程的安装方法都不一样,搞得我很郁闷,而且,都没有成功。最后还是通过官网上的教程安装成功。
2.1 选择安装指南
2.2 点进入之后选择通用二进制版本。 installing MySQL on Unix/Linux Using Generic Binaries
2.3 按照上面的操作一步一步执行就可以了。
shell> yum search libaio # search for info(Mysql安装需要以来libaio库,所以需要先安装libaio库)shell> yum install libaio # install libraryshell> groupadd mysqlshell> useradd -r -g mysql -s /bin/false mysqlshell> cd /usr/localshell> tar zxvf /path/to/mysql-VERSION-OS.tar.gzshell> ln -s full-path-to-mysql-VERSION-OS mysqlshell> cd mysqlshell> mkdir mysql-filesshell> chmod 750 mysql-filesshell> chown -R mysql .shell> chgrp -R mysql .shell> bin/mysql_install_db --user=mysql # MySQL 5.7.5 (mysql5.7.5选择使用这个命令,如果你的mysql是5.7.6及以上,不需要执行这个命令)shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and upshell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and upshell> chown -R root .shell> chown -R mysql data mysql-filesshell> bin/mysqld_safe --user=mysql &# Next command is optionalshell> cp support-files/mysql.server /etc/init.d/mysql.server
2.4 安装结束后,启动mysql服务
[root@***** /]# cd ~ #这里有一个问题,不知道需要需要切换到 “~”目录,之前没有“~”,启动不成功,不确定是我sytemctl start mysqld.service命令输入错了还是别的原因。[root@***** ~]# sytemctl start mysqld.service
[root@***** ~]# sytemctl status mysqld.service
2.5 获取安装时的临时密码,用以登录mysql
grep'temporary password'/var/log/mysqld.log2017-05-10T00:55:46.982233Z 1 [Note] A temporary password is generated for root@localhost: 5C::+lMjqi+z
2.5 使用临时密码登录
[root@****** ~]# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 5Server version: 5.7.18
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';Query OK, 0 rows affected (0.00 sec)
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
更多相关文章
- MySQL系列多表连接查询92及99语法示例详解教程
- Pycharm安装PyQt5的详细教程
- 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程
- android用户界面之按钮(Button)教程实例汇
- Android(安卓)- Manifest 文件 详解
- 【Android(安卓)开发教程】Toast通知
- Android的Handler机制详解3_Looper.looper()不会卡死主线程
- Android简易实战教程--第三十九话《Chronometer实现倒计时》
- Selector、shape详解(一)