当前位置:   article > 正文

linux mysql 命令行安装_MySQL -- Linux命令行安装

mysql linux命令行安装

环境 :服务器 :CentOS 7

1.输入 yum list | grep mysql 命令来查看yum上提供的mysql数据库可下载的版本

[root@localhost ~]# yum list | grep mysql

可看到例如:

akonadi-mysql.x86_64 1.9.2-4.el7 base

apr-util-mysql.x86_64 1.5.2-6.el7 base

calligra-kexi-driver-mysql.x86_64 2.9.10-2.el7 epel

collectd-mysql.x86_64 5.8.1-1.el7 epel

dmlite-plugins-mysql.x86_64 1.13.2-2.el7 epel

dovecot-mysql.x86_64 1:2.2.36-3.el7_7.1 updates

dpm-copy-server-mysql.x86_64 1.13.0-1.el7 epel

dpm-name-server-mysql.x86_64 1.13.0-1.el7 epel

dpm-server-mysql.x86_64 1.13.0-1.el7 epel

dpm-srm-server-mysql.x86_64 1.13.0-1.el7 epel

dspam-mysql.x86_64 3.10.2-12.el7 epel

exim-mysql.x86_64 4.92.3-1.el7 epel

freeradius-mysql.x86_64 3.0.13-10.el7_6 base

fts-mysql.x86_64 3.8.4-2.el7 epel

gnokii-smsd-mysql.x86_64 0.6.31-17.el7 epel

holland-mysql.noarch 1.1.21-1.el7 epel

holland-mysqldump.noarch 1.1.21-1.el7 epel

holland-mysqllvm.noarch 1.1.21-1.el7 epel

lfc-server-mysql.x86_64 1.13.0-1.el7 epel

libdbi-dbd-mysql.x86_64 0.8.3-16.el7 base

libgda-mysql.x86_64 1:5.2.2-7.el7 epel

libnss-mysql.x86_64 1.5-19.el7 epel

libodb-mysql.x86_64 2.3.0-1.el7 epel

libodb-mysql-devel.x86_64 2.3.0-1.el7

2.然后我们可以通过输入 yum install -y mysql-server mysql mysql-devel 命令将mysql mysql-server mysql-devel都安装好

3.rpm -qi mysql-server查看是否安装成功 成功的话 可以 service mysqld start。

[root@localhost ~]# rpm -qi mysql-server

未安装软件包 mysql-server

4.但是上面更新下载列表根本没有要安装的(因为当前系统没有支持mysql数据库快捷方式下载) mysql-server, mysql, mysql-devel 出现 mysql-server不存在。

5.这时候我们需要自己下载关联mysql可下载映射文件,并且升级安装rpm

[root@localhost ~]# yum list installed | grep mysql

2020-02-11 13:00:59 (11.3 MB/s) - 已保存 “mysql-community-release-el6-5.noarch.rpm” [5824/5824])

[root@localhost ~]# rpm -ivh mysql-community-release-el6-5.noarch.rpm

正在升级/安装...

1:mysql-community-release-el6-5 ################################# [100%]

6.再次查看可升级下载mysql组件

[root@localhost ~]# yum list | grep mysql

mysql-community-release.noarch el6-5 installed

akonadi-mysql.x86_64 1.9.2-4.el7 base

apr-util-mysql.x86_64 1.5.2-6.el7 base

dovecot-mysql.x86_64 1:2.2.36-3.el7_7.1 updates

freeradius-mysql.x86_64 3.0.13-10.el7_6 base

libdbi-dbd-mysql.x86_64 0.8.3-16.el7 base mysql-community-bench.i686 5.6.42-2.el6 mysql56-community

mysql-community-bench.x86_64 5.6.47-2.el6 mysql56-community

mysql-community-client.i686 5.6.47-2.el6 mysql56-community

mysql-community-client.x86_64 5.6.47-2.el6 mysql56-community

mysql-community-common.i686 5.6.47-2.el6 mysql56-community

mysql-community-common.x86_64 5.6.47-2.el6 mysql56-community

mysql-community-devel.i686 5.6.47-2.el6 mysql56-community

mysql-community-devel.x86_64 5.6.47-2.el6 mysql56-community

mysql-community-embedded.i686 5.6.47-2.el6 mysql56-community

mysql-community-embedded.x86_64 5.6.47-2.el6 mysql56-community

mysql-community-embedded-devel.i686 5.6.47-2.el6 mysql56-community

mysql-community-embedded-devel.x86_64 5.6.47-2.el6 mysql56-community

mysql-community-libs.i686 5.6.47-2.el6 mysql56-community

mysql-community-libs.x86_64 5.6.47-2.el6 mysql56-community

mysql-community-libs-compat.i686 5.6.47-2.el6 mysql56-community

mysql-community-libs-compat.x86_64 5.6.47-2.el6 mysql56-community

mysql-community-server.i686 5.6.42-2.el6 mysql56-community

mysql-community-server.x86_64 5.6.47-2.el6 mysql56-community

mysql-community-test.x86_64 5.6.47-2.el6 mysql56-community mysql-connector-c++.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-c++-debuginfo.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-c++-devel.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-c++-jdbc.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-java.noarch 1:8.0.19-1.el6 mysql-connectors-community

mysql-connector-odbc.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-odbc-debuginfo.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-odbc-setup.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-python.noarch 2.0.4-1.el6 mysql-connectors-community

mysql-connector-python.x86_64 2.1.7-1.el6 mysql-connectors-community

mysql-connector-python-cext.x86_64 2.1.7-1.el6 mysql-connectors-community

mysql-connector-python-debuginfo.x86_64 2.1.7-1.el6 mysql-connectors-community mysql-connector-c++.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-c++-debuginfo.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-c++-devel.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-c++-jdbc.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-java.noarch 1:8.0.19-1.el6 mysql-connectors-community

mysql-connector-odbc.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-odbc-debuginfo.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-odbc-setup.x86_64 8.0.19-1.el6 mysql-connectors-community

mysql-connector-python.noarch 2.0.4-1.el6 mysql-connectors-community

mysql-connector-python.x86_64 2.1.7-1.el6 mysql-connectors-community

mysql-connector-python-cext.x86_64 2.1.7-1.el6 mysql-connectors-community

mysql-connector-python-debuginfo.x86_64 2.1.7-1.el6 mysql-connectors-community7.执行安装 yum install mysql-community-server -y

已安装:

mysql-community-client.x86_64 0:5.6.47-2.el6 mysql-community-devel.x86_64 0:5.6.47-2.el6

mysql-community-libs.x86_64 0:5.6.47-2.el6 mysql-community-server.x86_64 0:5.6.47-2.el6

作为依赖被安装:

mysql-community-common.x86_64 0:5.6.47-2.el6 net-tools.x86_64 0:2.0-0.25.20131004git.el7

perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7

perl-DBI.x86_64 0:1.627-4.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7

perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7

perl-PlRPC.noarch 0:0.2020-14.el7

替代:

mariadb.x86_64 1:5.5.64-1.el7 mariadb-devel.x86_64 1:5.5.64-1.el7 mariadb-libs.x86_64 1:5.5.64-1.el7

8. rpm -qi mysql-community-server 查看版本 然后service mysqld start启动 (注意解压版本mysqld 这个是自己定义的)

9.先登录mysql

./mysql -u root -p #bin目录下

11.执行下面命令

SET PASSWORD = PASSWORD('123456');

ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

FLUSH PRIVILEGES;

这里主要执行下面三个命令(先登录数据库)

11.设置外部访问权限

use mysql #访问mysql库

update user set host = '%' where user = 'root'; #使root能再任何host访问

FLUSH PRIVILEGES;

重启linux

reboot

查看mysql状态

service mysqld status ——————————————————————-

本文章参考验证而来,仅供学习,如有错误可私聊指出,谢谢,查看更多笔记可关注订阅号。

- - 微信订阅号 随行笔记1024

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/676983
推荐阅读
相关标签
  

闽ICP备14008679号