yum安装mysql5.6

IT
IT
IT
335
文章
1
评论
2020年4月3日13:30:51 评论 888 3109字阅读10分21秒

卸载mariadb

[root@localhost ~]# yum -y remove mariadb-libs

安装MySQL的yum源

[root@localhost ~]# yum -y install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

安装mysql

[root@localhost ~]# yum -y install mysql mysql-devel mysql-server mysql-utilities

启动MySQL

[root@localhost ~]# systemctl start mysqld.service
[root@localhost ~]# systemctl enable mysqld.service

初始化数据库

[root@localhost ~]# mysql -V
mysql  Ver 14.14 Distrib 5.6.47, for Linux (x86_64) using  EditLine wrapper
[root@localhost ~]# /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!


All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...
[root@localhost ~]#

登陆mysql

[root@localhost ~]# mysql -hlocalhost -uroot -p123456 

Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.6.47 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, 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> exit
Bye

[root@localhost ~]# mysql -uroot -p123456 
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.6.47 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, 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.
继续阅读
  • 我的QQ
  • QQ扫一扫
  • weinxin
  • 我的头条
  • 头条扫一扫
  • weinxin
DB Mysql 最后更新:2020-4-11
IT
  • 本文由 发表于 2020年4月3日13:30:51
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
MySQL备份与恢复 DB

MySQL备份与恢复

备份和恢复discuz库 # mysqldump -uroot -p654321 discuz > /data/discuz.sql //备份discuz库 # mysql -uroot -p6...
Mysql授权 DB

Mysql授权

授权一个指定账号 # mysql -uroot -p123456 mysql: Using a password on the command line interface can be insecu...
CentOS下MySQL 5.7编译安装 DB

CentOS下MySQL 5.7编译安装

简述 MySQL 5.7 GA版本的发布,也就是说从现在开始5.7已经可以在生产环境中使用,有任何问题官方都将立刻修复。 MySQL 5.7主要特性: 更好的性能:对于多核CPU、固态硬盘、锁有着更好...