二、彻底卸载MySQL数据库,4、修改仓库美高梅开

2019-12-04 02:24栏目:美高梅网上游戏
TAG:

一、卸载Centos7自带的Maridb数据库

卸载maridb:
[root@host-131 ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.52-1.el7.x86_64
[root@host-131 ~]# yum -y remove mari*
[root@host-131 ~]# rm -rf /var/lib/mysql/*
[root@host-131 ~]# rpm -qa | grep mariadb
[root@host-131 ~]#

三、Yum的方法安装MySQL:

  • yum安装mysql 5.7 的官方安装方法地址

1、下载安装包

  • *此地址为Mysql 8.0 的安装源其中包含MySQL 5.7的源,可以在后边步骤修改开放的仓库: *

2、 设置安装初始环境

暂时先把防火墙关闭保证实验顺利:
[root@host-131 ~]# systemctl stop firewalld 
[root@host-131 ~]# systemctl disable firewalld.service
临时关闭SELlinux:
[root@host-131 ~]# setenforce 0
永久关闭SELinux:
[root@host-131 ~]# sed -ri '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config
查看SELinux状态:
[root@host-131 ~]# getenforce
Disabled

 3、卸载系统自带的数据库(Centos7自带的是maridb)

在linux上安装MySQL数据库,并简单设置用户密码,登录MySQL,linuxmysql

在新装的Centos系统上安装MySQL数据库。

<p><a href=";

>>提君博客原创    <<

第一步,检查是否已安装MySQL,如果已安装就卸载掉。

[[email protected] ~]# rpm -e mysql
error: package mysql is not installed

一步搞定,不需要事先执行检查命令了,直接执行卸载命令,有就删,没有也就不用管了。

第二步,执行安装

[[email protected] ~]# yum -y install mysql mysql-server mysql-devel
...
...
...
Complete!

出现complete表示安装成功。

>>提君博客原创    <<

第三步,开启服务

[[email protected] ~]# service mysqld start
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h ltt5.bg.cn password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

第四步,设置开机启动

[[email protected] ~]# chkconfig mysqld on
[[email protected] ~]# chkconfig --list  mysqld 
mysqld             0:off    1:off    2:on    3:on    4:on    5:on    6:off

第五步,初始设置登录用户和密码

[[email protected] ~]# mysqladmin -u root password 'root'

第六步,登录MySQL数据库

[[email protected] ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 5
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, 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> 

输入root密码,敲enter登录

第七步,查看帮助

mysql> help;

For information about MySQL products and services, visit:
   http://www.mysql.com/
For developer information, including the MySQL Reference Manual, visit:
   http://dev.mysql.com/
To buy MySQL Enterprise support, training, or other products, visit:
   https://shop.mysql.com/

List of all MySQL commands:
Note that all text commands must be first on line and end with ';'
?         (?) Synonym for `help'.
clear     (c) Clear the current input statement.
connect   (r) Reconnect to the server. Optional arguments are db and host.
delimiter (d) Set statement delimiter.
edit      (e) Edit command with $EDITOR.
ego       (G) Send command to mysql server, display result vertically.
exit      (q) Exit mysql. Same as quit.
go        (g) Send command to mysql server.
help      (h) Display this help.
nopager   (n) Disable pager, print to stdout.
notee     (t) Don't write into outfile.
pager     (P) Set PAGER [to_pager]. Print the query results via PAGER.
print     (p) Print current command.
prompt    (R) Change your mysql prompt.
quit      (q) Quit mysql.
rehash    (#) Rebuild completion hash.
source    (.) Execute an SQL script file. Takes a file name as an argument.
status    (s) Get status information from the server.
system    (!) Execute a system shell command.
tee       (T) Set outfile [to_outfile]. Append everything into given outfile.
use       (u) Use another database. Takes database name as argument.
charset   (C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
warnings  (W) Show warnings after every statement.
nowarning (w) Don't show warnings after every statement.

For server side help, type 'help contents'

第八步,查看系统原装的数据库

mysql> show databases
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

第九步,创建数据库

<p><a href=";

mysql> create database hive
    -> ;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| hive               |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

第十步,退出

mysql> quit
Bye

至此,MySQL数据的安装和简单设置就介绍完毕。

>>提君博客原创    <<

<p><a href=";

在新装的Centos系统上安装MySQL数据库。 pa href="...

彻底卸载Yum安装的MySQL数据库

  • 在我第二章MySQL数据库基于Centos7.3-部署过程中,因为以前安装过其它的版本所以没有卸载干净影响后期安装

一、MySQL数据库的官方网址:

  • https://www.oracle.com/
  • http://dev.mysql.com/doc/refman/5.7/en/linux-installation.html
  •        //不同版本的安装文档和下载可以在这里找

版权声明:本文由美高梅开户送58元官网发布于美高梅网上游戏,转载请注明出处:二、彻底卸载MySQL数据库,4、修改仓库美高梅开