linux wget+yum+MySQL安装

wget

Linux系统中的wget是一个下载文件的工具,它用在命令行下。对于Linux用户是必不可少的工具,我们经常要下载一些软件或从远程服务器恢复备份到本地服务器。wget支持HTTP,HTTPS和FTP协议,可以使用HTTP代理。所谓的自动下载是指,wget可以在用户退出系统的之后在后台执行。这意味这你可以登录系统,启动一个wget下载任务,然后退出系统,wget将在后台执行直到任务完成,相对于其它大部分浏览器在下载大量数据时需要用户一直的参与,这省去了极大的麻烦。

yum

基于RPM的软件包管理器,yum提供了查找、安装、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。

yum --help
Loaded plugins: fastestmirror
Usage: yum [options] COMMAND

List of Commands:

check          Check for problems in the rpmdb
check-update   Check for available package updates
clean          Remove cached data
deplist        List a package's dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade      downgrade a package
erase          Remove a package or packages from your system
fs             Acts on the filesystem data of the host, mainly for removing docs/lanuages for minimal hosts.
fssnapshot     Creates filesystem snapshots, or lists/deletes current snapshots.
groups         Display, or use, the groups information
help           Display a helpful usage message
history        Display, or use, the transaction history
info           Display details about a package or group of packages
install        Install a package or packages on your system
list           List a package or groups of packages
load-transaction load a saved transaction from filename
makecache      Generate the metadata cache
provides       Find what package provides the given value
reinstall      reinstall a package
repo-pkgs      Treat a repo. as a group of packages, so we can install/remove all of them
repolist       Display the configured software repositories
search         Search package details for the given string
shell          Run an interactive yum shell
swap           Simple way to swap packages, instead of using shell
update         Update a package or packages on your system
update-minimal Works like upgrade, but goes to the 'newest' package match which fixes a problem that affects your system
updateinfo     Acts on repository update information
upgrade        Update packages taking obsoletes into account
version        Display a version for the machine and/or available repos.


Options:
  -h, --help            show this help message and exit
  -t, --tolerant        be tolerant of errors
  -C, --cacheonly       run entirely from system cache, don't update cache
  -c [config file], --config=[config file]
                        config file location
  -R [minutes], --randomwait=[minutes]
                        maximum command wait time
  -d [debug level], --debuglevel=[debug level]
                        debugging output level
  --showduplicates      show duplicates, in repos, in list/search commands
  -e [error level], --errorlevel=[error level]
                        error output level
  --rpmverbosity=[debug level name]
                        debugging output level for rpm
  -q, --quiet           quiet operation
  -v, --verbose         verbose operation
  -y, --assumeyes       answer yes for all questions
  --assumeno            answer no for all questions
  --version             show Yum version and exit
  --installroot=[path]  set install root
  --enablerepo=[repo]   enable one or more repositories (wildcards allowed)
  --disablerepo=[repo]  disable one or more repositories (wildcards allowed)
  -x [package], --exclude=[package]
                        exclude package(s) by name or glob
  --disableexcludes=[repo]
                        disable exclude from main, for a repo or for
                        everything
  --disableincludes=[repo]
                        disable includepkgs for a repo or for everything
  --obsoletes           enable obsoletes processing during updates
  --noplugins           disable Yum plugins
  --nogpgcheck          disable gpg signature checking
  --disableplugin=[plugin]
                        disable plugins by name
  --enableplugin=[plugin]
                        enable plugins by name
  --skip-broken         skip packages with depsolving problems
  --color=COLOR         control whether color is used
  --releasever=RELEASEVER
                        set value of $releasever in yum config and repo files
  --downloadonly        don't update, just download
  --downloaddir=DLDIR   specifies an alternate directory to store packages
  --setopt=SETOPTS      set arbitrary config and repo options
  --bugfix              Include bugfix relevant packages, in updates
  --security            Include security relevant packages, in updates
  --advisory=ADVS, --advisories=ADVS
                        Include packages needed to fix the given advisory, in
                        updates
  --bzs=BZS             Include packages needed to fix the given BZ, in
                        updates
  --cves=CVES           Include packages needed to fix the given CVE, in
                        updates
  --sec-severity=SEVS, --secseverity=SEVS
                        Include security relevant packages matching the
                        severity, in updates

  Plugin Options:

安装MySQL

删除系统自带MySQL

检查系统是否已经安装MySQL,如果安装删除重新安装:

rpm -qa | grep mysql

删除

 yum list installed | grep mysql  //查看
 yum -y remove mysql-libs.x86_64   //删除

从Mysql官网下载Mysql源

wget -P /home/host http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

其中:/home/host是下载位置。

安装mysql源

rpm -Uvh mysql57-community-release-el7-11.noarch.rpm

安装MySQL

yum install mysql-community-server -y
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql57-community-release-el7-11 ################################# [100%]
[root@iZ8vbbxvvkohgighzh3rtfZ mysql]# vim /etc/yum.repos.d/mysql-community.repo
[root@iZ8vbbxvvkohgighzh3rtfZ mysql]# yum install mysql-community-server -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
mysql-connectors-community                                   | 2.5 kB  00:00:00     
mysql-tools-community                                        | 2.5 kB  00:00:00     
mysql57-community                                            | 2.5 kB  00:00:00     
(1/3): mysql-connectors-community/x86_64/primary_db          |  48 kB  00:00:00     
(2/3): mysql-tools-community/x86_64/primary_db               |  66 kB  00:00:00     
(3/3): mysql57-community/x86_64/primary_db                   | 190 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.28-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.28-1.el7 for package: mysql-community-server-5.7.28-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.28-1.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-5.7.28-1.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-5.7.28-1.el7.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-5.7.28-1.el7.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package mariadb.x86_64 1:5.5.64-1.el7 will be obsoleted
---> Package mysql-community-client.x86_64 0:5.7.28-1.el7 will be obsoleting
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.28-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.28-1.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.64-1.el7 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
---> Package mysql-community-libs.x86_64 0:5.7.28-1.el7 will be obsoleting
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.28-1.el7 will be obsoleting
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================
 Package                       Arch     Version           Repository           Size
====================================================================================
Installing:
 mysql-community-client        x86_64   5.7.28-1.el7      mysql57-community    43 M
     replacing  mariadb.x86_64 1:5.5.64-1.el7
 mysql-community-libs          x86_64   5.7.28-1.el7      mysql57-community   4.2 M
     replacing  mariadb-libs.x86_64 1:5.5.64-1.el7
 mysql-community-libs-compat   x86_64   5.7.28-1.el7      mysql57-community   1.3 M
     replacing  mariadb-libs.x86_64 1:5.5.64-1.el7
 mysql-community-server        x86_64   5.7.28-1.el7      mysql57-community   199 M
Installing for dependencies:
 libaio                        x86_64   0.3.109-13.el7    base                 24 k
 mysql-community-common        x86_64   5.7.28-1.el7      mysql57-community   311 k

Transaction Summary
====================================================================================
Install  4 Packages (+2 Dependent packages)

Total download size: 248 M
Downloading packages:
(1/6): libaio-0.3.109-13.el7.x86_64.rpm                      |  24 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.28-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-5.7.28-1.el7.x86_64.rpm is not installed
(2/6): mysql-community-common-5.7.28-1.el7.x86_64.rpm        | 311 kB  00:00:01     
(3/6): mysql-community-libs-5.7.28-1.el7.x86_64.rpm          | 4.2 MB  00:00:01     
(4/6): mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm   | 1.3 MB  00:00:00     
(5/6): mysql-community-client-5.7.28-1.el7.x86_64.rpm        |  43 MB  00:00:09     
(6/6): mysql-community-server-5.7.28-1.el7.x86_64.rpm                                    | 199 MB  00:00:25     
----------------------------------------------------------------------------------------------------------------
Total                                                                           8.9 MB/s | 248 MB  00:00:27     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package    : mysql57-community-release-el7-11.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : mysql-community-common-5.7.28-1.el7.x86_64                                                   1/8 
  Installing : mysql-community-libs-5.7.28-1.el7.x86_64                                                     2/8 
  Installing : mysql-community-client-5.7.28-1.el7.x86_64                                                   3/8 
  Installing : libaio-0.3.109-13.el7.x86_64                                                                 4/8 
  Installing : mysql-community-server-5.7.28-1.el7.x86_64                                                   5/8 
  Installing : mysql-community-libs-compat-5.7.28-1.el7.x86_64                                              6/8 
  Erasing    : 1:mariadb-5.5.64-1.el7.x86_64                                                                7/8 
  Erasing    : 1:mariadb-libs-5.5.64-1.el7.x86_64                                                           8/8 
  Verifying  : libaio-0.3.109-13.el7.x86_64                                                                 1/8 
  Verifying  : mysql-community-common-5.7.28-1.el7.x86_64                                                   2/8 
  Verifying  : mysql-community-libs-compat-5.7.28-1.el7.x86_64                                              3/8 
  Verifying  : mysql-community-libs-5.7.28-1.el7.x86_64                                                     4/8 
  Verifying  : mysql-community-client-5.7.28-1.el7.x86_64                                                   5/8 
  Verifying  : mysql-community-server-5.7.28-1.el7.x86_64                                                   6/8 
  Verifying  : 1:mariadb-libs-5.5.64-1.el7.x86_64                                                           7/8 
  Verifying  : 1:mariadb-5.5.64-1.el7.x86_64                                                                8/8 

Installed:
  mysql-community-client.x86_64 0:5.7.28-1.el7              mysql-community-libs.x86_64 0:5.7.28-1.el7          
  mysql-community-libs-compat.x86_64 0:5.7.28-1.el7         mysql-community-server.x86_64 0:5.7.28-1.el7        

Dependency Installed:
  libaio.x86_64 0:0.3.109-13.el7                  mysql-community-common.x86_64 0:5.7.28-1.el7                 

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

Complete!

配置MYSQL

启动MYSQL

systemctl start mysqld.service

查看状态

systemctl status mysqld.service

添加开机启动

 systemctl enable mysqld.service

修改密码

查看默认密码

grep 'password' /var/log/mysqld.log

登录mysql

mysql -u root -p

修改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Abcd#123';

因为MySQL默认的安全机制,所以必须设置一定安全级别的密码,如果想要设置低级别的密码,需要修改默认配置。

设置远程登录

一般来说你的帐号不允许从远程登陆,这个时候只要在localhost的那台服务器,登入mysql,
更改 mysql 数据库里的 user 表里的 host 项,从localhost改称%就能远程访问了!

mysql -u root -p 
mysql>use mysql; 
mysql>update user set host = '%' where user = 'root'; 
mysql>select host, user from user;
mysql>flush privileges;
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值