iso如何装mysql_Centos7系统中Mysql数据库的安装

本文档详细介绍了在CentOS7系统上通过二进制方式安装MySQL5.7.29的步骤,包括上传与解压安装包、创建用户与目录、设置环境变量、挂载新硬盘、配置数据库及启动服务等关键操作。
摘要由CSDN通过智能技术生成

一:二进制mysql数据库的安装

环境:

1 [root@molson ~]# cat /etc/redhat-release2 CentOS Linux release 7.3.1611 (Core)

二进制Mysql的版本:mysql5.7.29版本

1)上传二进制mysql包到/usr/local/src目录中,如下

1 [root@molson src]# ll2 总用量 649172

3 -rw-r--r--. 1 root root 664749587 10月 1 18:14 mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz

2)解压Mysql包并放到/apps目录中,如下

1 [root@molson src]# tar xf mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz2 [root@molson src]# mv mysql-5.7.29-linux-glibc2.12-x86_64 mysql-5.7.29

3 [root@molson src]# mkdir /apps/

4 [root@molson src]# mv mysql-5.7.29 /apps5 [root@molson src]# ln -sv /apps/mysql-5.7.29/ /apps/mysql6 "/apps/mysql" -> "/apps/mysql-5.7.29/"

7 [root@molson src]# ll /apps8 总用量 0

9 lrwxrwxrwx. 1 root root 19 10月 1 18:19 mysql -> /apps/mysql-5.7.29/

10 drwxr-xr-x. 9 root root 129 10月 1 18:18 mysql-5.7.29

11 [root@molson src]#

3)用户的创建,处理原始环境,相关目录的创建,如下

1 [root@molson src]# rpm -qa | grepmariadb2 mariadb-libs-5.5.52-1.el7.x86_643 [root@molson src]# yum remove mariadb-libs-5.5.52-1.el7.x86_64 -y4 [root@molson src]# rpm -qa | grepmariadb5 [root@molson src]#6

7 [root@molson src]# useradd mysql -s /sbin/nologin8 [root@molson src]# getent passwd | grepmysql9 mysql:x:1000:1000::/home/mysql:/sbin/nologin10 [root@molson src]#

11 [root@molson src]#mkdir /apps/

4)设置环境变量,并验证,如下

1 [root@molson src]# echo 'export PATH=/apps/mysql/bin:$PATH' >> /etc/profile2 [root@molson src]# tail -1 /etc/profile3 export PATH=/apps/mysql/bin:$PATH4 [root@molson src]# source /etc/profile5 [root@molson src]# mysql -V6 mysql Ver 14.14 Distrib 5.7.29, for linux-glibc2.12(x86_64) using EditLine wrapper7 [root@molson src]#

5)添加硬盘,首先关闭虚拟机,如下

488445d3839139473990ffe19be9398f.png

点击上图的点击虚拟机,如下

94043e8c37e63ee5ee7cde0ff9f5ccf4.png

按照上图红色标记操作,会出现如下图

3898909f44aeb9312837bb4d66f08e59.png

点击下一步,会出现如下图

6eee1eaaf53fc34b85105d7188ebccad.png

点击上图红色标记,会出现下图,如下

1f4430d691b6db3101eb85ab8803ad2a.png

继续点击下一步,

9322ac745e5e2c404ea7f72ae9450e10.png

按照上图所示,继续点击下一步,会出现如下图

3eb68313d0766478481683fcc0970568.png

在上图红色标记的地方,选择硬盘的大小,并进行下一步

84f66693cf067445a0c3ded8797a78a1.png

按照上图所示,点击完成

8846843882ac4a28a3dd5c1ef1a0b59b.png

点击确定,硬盘添加完成

打开虚拟机,执行df -h验证磁盘信息,如下

1 [root@molson ~]# mkfs.xfs /dev/sdb2 meta-data=/dev/sdb isize=512 agcount=4, agsize=655360blks3 = sectsz=512 attr=2, projid32bit=1

4 = crc=1 finobt=0, sparse=0

5 data = bsize=4096 blocks=2621440, imaxpct=25

6 = sunit=0 swidth=0blks7 naming =version 2 bsize=4096 ascii-ci=0 ftype=1

8 log =internal log bsize=4096 blocks=2560, version=2

9 = sectsz=512 sunit=0 blks, lazy-count=1

10 realtime =none extsz=4096 blocks=0, rtextents=0

11 [root@molson ~]# blkid12 /dev/sda1: UUID="edbdd70a-2ad0-4c06-b9fc-85feced3fe85" TYPE="xfs"

13 /dev/sda2: UUID="db1d012f-3a61-4f57-8661-9bd5064b2681" TYPE="swap"

14 /dev/sda3: UUID="fdfb2e53-958e-49ef-ba4d-dfd68efd0ad6" TYPE="xfs"

15 /dev/sr0: UUID="2016-12-05-13-55-45-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos"

16 /dev/sdb: UUID="3ba7b93d-3ea0-4c60-a041-d79c62ee26a2" TYPE="xfs"

开始挂载,把硬盘相关信息,写入到/etc/profile文件中,如下图

e7afc72d4c7b4a0d0ab2b77f17b0449c.png

执行如下信息,使挂载信息生效,并验证,如下

1 [root@molson ~]# mkdir /data/mysql -pv2 [root@molson ~]# mount -a3 [root@molson ~]# df -h4 文件系统 容量 已用 可用 已用%挂载点5 /dev/sda3 14G 4.2G 9.8G 30% /

6 devtmpfs 479M 0 479M 0% /dev7 tmpfs 489M 0 489M 0% /dev/shm8 tmpfs 489M 6.7M 482M 2% /run9 tmpfs 489M 0 489M 0% /sys/fs/cgroup10 /dev/sda1 4.0G 131M 3.9G 4% /boot11 tmpfs 98M 0 98M 0% /run/user/0

12 /dev/sdb 10G 33M 10G 1% /data

6)添加Mysql的配置文件,配置文件的信息如下

[root@molson etc]# catmy.cnf

[mysqld]

user=mysql

basedir=/apps/mysql

datadir=/data/mysql

socket=/tmp/mysql.sock

server_id=6port=3306[mysql]

socket=/tmp/mysql.sock

6)添加systemctl启动的配置文件信息,如下

1 [root@molson system]# pwd

2 /usr/lib/systemd/system3 [root@molson system]# catmysql.service4 [Unit]5 Description=MySQL Server6 Documentation=man:mysqld(8)7 Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html

8 After=network.target9 After=syslog.target10 [Install]11 WantedBy=multi-user.target12 [Service]13 User=mysql14 Group=mysql15 ExecStart=/apps/mysql/bin/mysqld --defaults-file=/etc/my.cnf16 LimitNOFILE = 5000

17 [root@molson system]#

7)相关目录对mysql用户进行授权,如下

1 [root@molson ~]# chown -R mysql.mysql /apps/mysql/*

2 [root@molson ~]# chown -R mysql.mysql /data/mysql

8)数据库进行初始化,如下

1 [root@molson ~]# mysqld --initialize --user=mysql --basedir=/apps/mysql --datadir=/data/mysql2 mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

注意:执行上述明明,报错,是因为缺少了一个库没有安装的,直接执行yum install -y libaio-devel 就可以安装,如下

1 [root@molson ~]# yum install -y libaio-devel

再一次初始化数据库,如下

1 [root@molson mysql]# mysqld --initialize-insecure --user=mysql --basedir=/apps/mysql --datadir=/data/mysql2 2020-10-01T11:07:05.093173Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for moredetails).3 2020-10-01T11:07:06.553509Z 0 [Warning] InnoDB: New log files created, LSN=45790

4 2020-10-01T11:07:06.633960Z 0[Warning] InnoDB: Creating foreign key constraint system tables.5 2020-10-01T11:07:06.735867Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3e427157-03d6-11eb-b605-000c296a99b4.6 2020-10-01T11:07:06.736490Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed'cannot be opened.7 2020-10-01T11:07:07.332095Z 0[Warning] CA certificate ca.pem is self signed.8 2020-10-01T11:07:07.598169Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.

像上述一样,执行完成没有ERR,说明安装成功。

9)启动并设置开机启动数据库,并验证,如下

1 [root@molson ~]# systemctl start mysql2 [root@molson ~]# systemctl enable mysql3 Created symlink from /etc/systemd/system/multi-user.target.wants/mysql.service to /usr/lib/systemd/system/mysql.service.4 [root@molson ~]# ss -ntl5 State Recv-Q Send-Q Local Address:Port Peer Address:Port6 LISTEN 0 128 *:22 *:*

7 LISTEN 0 80 :::3306 :::*

8 LISTEN 0 128 :::22 :::*

9 [root@molson ~]# ps -ef | grepmysql10 mysql 2096 1 10 19:00 ? 00:00:01 /apps/mysql/bin/mysqld --defaults-file=/etc/my.cnf11 root 2157 1476 0 19:01 pts/0 00:00:00 grep --color=auto mysql12 [root@molson ~]#

综上所述,数据库安装成功

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
毕业设计,基于SpringBoot+Vue+MySQL开发的纺织品企业财务管理系统,源码+数据库+毕业论文+视频演示 在如今社会上,关于信息上面的处理,没有任何一个企业或者个人会忽视,如何让信息急速传递,并且归档储存查询,采用之前的纸张记录模式已经不符合当前使用要求了。所以,对纺织品企业财务信息管理的提升,也为了对纺织品企业财务信息进行更好的维护,纺织品企业财务管理系统的出现就变得水到渠成不可缺少。通过对纺织品企业财务管理系统的开发,不仅仅可以学以致用,让学到的知识变成成果出现,也强化了知识记忆,扩大了知识储备,是提升自我的一种很好的方法。通过具体的开发,对整个软件开发的过程熟练掌握,不论是前期的设计,还是后续的编码测试,都有了很深刻的认知。 纺织品企业财务管理系统通过MySQL数据库与Spring Boot框架进行开发,纺织品企业财务管理系统能够实现对财务人员,员工,收费信息,支出信息,薪资信息,留言信息,报销信息等信息的管理。 通过纺织品企业财务管理系统对相关信息的处理,让信息处理变的更加的系统,更加的规范,这是一个必然的结果。已经处理好的信息,不管是用来查找,还是分析,在效率上都会成倍的提高,让计算机变得更加符合生产需要,变成人们不可缺少的一种信息处理工具,实现了绿色办公,节省社会资源,为环境保护也做了力所能及的贡献。 关键字:纺织品企业财务管理系统,薪资信息,报销信息;SpringBoot
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值