Thinkpad E15系统 mysql安装教程


产品规格:Thinkpad E15
系统版本:centos7
软件版本:mysql 5.7
mysql安装实例教程
1.应用yum安装mysql数据库的程序包
[root@xuegod63 ~]# yum -y Install mariadb-server mariadb
注:
mariadb-server #MariaDB数据库
mariadb# MariaDB网络服务器Linux下手机客户端
注:从centos7系统软件逐渐 , 系统软件中内置的mysql数据库变成了mariadb-server , mariadb-server和mysql实际操作上一样 。mariadb-server是mysql的一个支系 。
2.运行数据库服务项目
[root@xuegod63 ~]# systemctl start mariadb #运行MariaDB服务项目
【Thinkpad E15系统 mysql安装教程】[root@xuegod63 ~]# systemctl enable mariadb #设定打开自动启动MariaDB服务项目
3. 安装完mariadb-server后 , 运作mysql_secure_installation除去安全风险
[root@xuegod63 ~]# 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): #第一次运作立即回车键 , 由于root客户沒有登陆密码
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#是不是设定root客户登陆密码,键入Y
New password: 123456 #密码123456
Re-enter new password: 123456
Password updated successfully!
。。。
Remove anonymous users? [Y/n] Y #是不是删掉匿名用户,工作环境提议删掉 , 因此立即回车键或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 #是不是严禁root远程登陆,依据自身的需要挑选 Y/n并回车键,提议严禁
... Success!
By default, MariaDB 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 #是不是删掉test数据库,立即回车键或Y
- Dropping test database...
... Success!
- 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!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
… Success!
至此数据库安裝取得成功 。
4. 登陆数据库
[root@xuegod63 ~]# mysql -u root -p123456
MariaDB [(none)]> show databases;#沒有test数据库 #实行时 , 全部指令以;号末尾
-------------------------
| Database|
-------------------------
| information_schema|
| mysql|
| ucenter |
-------------------------
3 rows in set (0.00 sec)
MariaDB [(none)]> exit #撤出指令可以加分号 , 还可以不用分号 。
汇总:
1、应用yum安装mysql数据库的程序包
2、运行数据库服务项目
3、运作mysql_secure_installation除去安全风险
4、登陆数据库