Mysql安装过程是怎样的
admin
2023-04-25 06:42:26
0

环境说明:
操作系统:Red Hat Linux 6
安装Mysql5.7版本

安装须知:
一、准备mysql的安装包
二、准备好安装环境

操作指导:
一、下载mysql的安装包
https://www.mysql.com/downloads/ 访问mysql下载地址,进行如下操作进行下载。

Mysql安装过程是怎样的

Mysql安装过程是怎样的

Mysql安装过程是怎样的

Mysql安装过程是怎样的

将下载好的mysql安装包放到自己建立的安装目录下,进行解压。

[root@root /]# cd /soft/
[root@root soft]# ll
总用量 1151432
-rw-r--r--. 1 root root  227512320 8月   7 17:59 MySQL-5.6.41-1.el6.x86_64.rpm-bundle.tar
-rw-r--r--. 1 root root  475770880 8月   7 18:21 mysql-5.7.23-1.el6.x86_64.rpm-bundle.tar
-rw-r--r--. 1 7155 31415  24024136 6月  11 11:21 mysql-community-client-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415    340072 6月  11 11:21 mysql-community-common-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415   3736628 6月  11 11:21 mysql-community-devel-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415  39496088 6月  11 11:21 mysql-community-embedded-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 137638820 6月  11 11:21 mysql-community-embedded-devel-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415   2192692 6月  11 11:21 mysql-community-libs-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415   1723712 6月  11 11:21 mysql-community-libs-compat-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 160480880 6月  11 11:21 mysql-community-server-5.7.23-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 106124936 6月  11 11:21 mysql-community-test-5.7.23-1.el6.x86_64.rpm

二、准备好安装环境
检查当前系统下是否有mysql服务,方法: rpm -qa | grep mysql。 如果有就用rpm卸载掉。可以使用的命令是 rpm -ev 程序(如果卸载报存在依赖关系问题就用,rpm -e --nodeps 程序 进行卸载, --nodeps 跳过依赖关系)

[root@root mysql]# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64
root@root mysql]# rpm -ev mysql-libs-5.1.71-1.el6.x86_64  /*报依赖关系*/
error: Failed dependencies:
        libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
[root@root soft]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64  /*卸载不含依赖关系*/
[root@root soft]#

三、进行mysql服务安装
进入到mysql包的解压目录下,用rpm进行安装。注意安装顺序,否则或报依赖关系错误。

[root@root soft]# rpm -ivh mysql-community-common-5.7.23-1.el6.x86_64.rpm
[root@root soft]# rpm -ivh mysql-community-libs-5.7.23-1.el6.x86_64.rpm
[root@root soft]# rpm -ivh mysql-community-client-5.7.23-1.el6.x86_64.rpm
[root@root soft]# rpm -ivh mysql-community-server-5.7.23-1.el6.x86_64.rpm

安装完成,修改配置文件。在/etc/my.cnf

[root@root etc]# vim my.cnf
[mysqld]
skip-grant-tables  /*添加,作用可以不用密码进行登录*/

启动mysql服务,输入mysql就可以进入数据库。(启用成功可以用 netstat -nlap | grep mysql  查看mysql服务)

[root@root soft]# service mysqld start
[root@root soft]# mysql  
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.7.23 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

这时,你可以使用navicat工具连接mysql服务了。如果连接不上,请检查3306端口是否开发,可以尝试关闭linux防火墙。service iptables stop

尝试连接成功后,我们可以为mysql服务设置密码。
先选择用户

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set authentication_string = password('111111'), password_expired = 'N', password_last_changed = now() where user = 'root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1
mysql> flush privileges; /*刷入配置,必须执行,否则后期错误信息*/
Query OK, 0 rows affected (0.00 sec)
mysql>

注:这个设置密码方式如果不对,可以尝试其它方法设置密码(如:mysqladmin -u root password “11111111”)。设置完密码切记要去my.cnf配置文件把skip-grant-tables 注释掉,在重启mysql服务。这是就可使用用户名密码登录。

相关内容

热门资讯

烈焰熊熊,堪比“原子弹”,欧洲... 据美国有线电视新闻网(CNN)7月29日报道,席卷法国西南部的大片野火燃烧得如此猛烈,以至于形成了一...
外交部:对日本熊本县地震遇难者... 据凤凰卫视报道,针对日本熊本县发生强震造成人员伤亡,中国外交部发言人毛宁7月29日在例行记者会上表示...
高铁喧哗被劝阻后叫嚣全家体制内... “女子高铁喧哗被劝阻后叫嚣全家体制内”一事迎来官方通报。据新京报报道,7月29日,辽宁北票市公安局发...
广东专业蓝牙耳机定制厂家推荐,... 在珠三角腹地,广东早已成为全球蓝牙耳机产业链的“心脏地带”。从深圳华强北的声学元件批发,到东莞、惠州...
格雷厄姆葬礼变地缘竞价场!两大... 有些葬礼,送别的是逝者;有些葬礼,演的却是活人最现实的政治博弈。当地时间7月28日,美国老牌鹰派参议...
一道小学数学题难住3名医学博士... 3名不同学校的博士同做一道数学题,谁最厉害?近日,一陕西网友发布的视频引发热议。29日,视频发布者“...
华为全新“小艺任务”亮相:整合... 7月29日,在华为鸿蒙电脑新品技术沟通会上,终端云服务小艺业务部总裁贾永利宣布,小艺将迎来“从对话到...
广西日报特稿《王的猜想》火了,... 澎湃新闻记者 蒋子文 实习生 汤煜炜为应对外界购买纸质版特稿《王的猜想》的热情,《广西日报》宣布紧急...
月租20元内!2026年平价云... 不少手游玩家、账号运营从业者挑选云手机时,首要诉求就是低价够用,想要控制每月支出在20元以内,同时兼...
诺奖得主如何看待王虹境遇?“我... 中村修二(2014年诺贝尔物理学奖得主)【导读】近日王虹与邓煜双双获得2026年菲尔兹奖,成为了首批...