centos7搜狐 mysql_【Linux】Centos7安装mysql数据库

2.安装中

注意在执行命令的过程中,会出现这样一句话,输入"y"后,继续执行。

is this ok? [y/d/N]

7722359d5941d52f2e42154e015405cb.png

安装mysql后

1.检查是否安装mysql的命令,可见已经成功安装mysql

[root@localhost admin]# rpm -qa |grep mysql

mysql-community-libs-5.6.42-2.el7.x86_64

mysql-community-client-5.6.42-2.el7.x86_64

mysql-community-common-5.6.42-2.el7.x86_64

mysql-community-release-el7-5.noarch

mysql-community-server-5.6.42-2.el7.x86_64

2.执行命令 mysqld --initialize时,发生了下面的错误。

[root@localhost admin]# mysqld --initialize

2018-10-29 23:16:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2018-10-29 23:16:46 0 [Note] mysqld (mysqld 5.6.42) starting as process 66214 ...

2018-10-29 23:16:46 66214 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2018-10-29 23:16:46 66214 [ERROR] Aborting

2018-10-29 23:16:46 66214 [Note] Binlog end

2018-10-29 23:16:46 66214 [Note] mysqld: Shutdown complete

关键思路

1.目的

我的目的是打开mysql数据库,不是初始化,所以我使用了另一篇博客中给出的命令,成功打开mysql数据库并创建了mysql用户。

2.打开mysql服务的命令

systemctl start mysql

查看mysql状态

[admin@localhost Desktop]$ systemctl status mysql

● mysqld.service - MySQL Community Server

Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

Active: active (running) since Mon 2018-10-29 23:02:14 PDT; 37min ago

Process: 65641 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)

Process: 65504 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)

Main PID: 65640 (mysqld_safe)

CGroup: /system.slice/mysqld.service

├─65640 /bin/sh /usr/bin/mysqld_safe --basedir=/usr

└─65806 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql -...

Oct 29 23:02:09 localhost.localdomain mysql-systemd-start[65504]: 2018-10-29 ...

Oct 29 23:02:10 localhost.localdomain mysql-systemd-start[65504]: 2018-10-29 ...

Oct 29 23:02:10 localhost.localdomain mysql-systemd-start[65504]: PLEASE REME...

Oct 29 23:02:10 localhost.localdomain mysql-systemd-start[65504]: To do so, s...

Oct 29 23:02:10 localhost.localdomain mysql-systemd-start[65504]: /usr/bin/my...

Oct 29 23:02:10 localhost.localdomain mysql-systemd-start[65504]: /usr/bin/my...

Oct 29 23:02:10 localhost.localdomain mysql-systemd-start[65504]: Alternative...

Oct 29 23:02:11 localhost.localdomain mysqld_safe[65640]: 181029 23:02:11 mys...

Oct 29 23:02:11 localhost.localdomain mysqld_safe[65640]: 181029 23:02:11 mys...

Oct 29 23:02:14 localhost.localdomain systemd[1]: Started MySQL Community Ser...

Hint: Some lines were ellipsized, use -l to show in full.

3.创建mysql用户命令

[root@localhost Desktop]# mysqladmin -uroot password

Enter password:

4.登录mysql

[root@localhost Desktop]# mysql -uroot -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 17

Server version: 5.6.42 MySQL Community Server (GPL)

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

0e70b66d5fbb96d351bcef43890aed98.png

小结

成功安装了mysql数据库并打开服务,创建用户,接下来就可以好好地操作mysql数据库啦!

6552e5431c450cb029337effc6fc5659.png

作者:十三期冯皓月

编辑:倪思雨

来源:CSDN

文:https://blog.csdn.net/m18633778874/article/details/83540567

版权声明:本文为博主原创文章,未经博主允许不得转载

喜欢我,就给我一个“好看”

b036029197a3f2e52731b5079bb58cc1.gif

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值