mysql8.0.11安装、启动与基本设置操作方法

发布时间:2020-05-28 15:46:15 作者:三月
来源:网络 阅读:555

下面讲讲关于mysql8.0.11安装、启动与基本设置操作方法,文字的奥妙在于贴近主题相关。所以,闲话就不谈了,我们直接看下文吧,相信看完mysql8.0.11安装、启动与基本设置操作方法这篇文章你一定会有所受益。                                                          

    此次演示的是mysql 8.0.11的安装、启动与基本设置。
    下载mysql-8.0.11-el7-x86_64.tar.gz

1、解压并重命名
[root@localhost ~]# cd /data
[root@localhost data]# ls
mysql-8.0.11-el7-x86_64.tar.gz
[root@localhost data]# tar -zxf mysql-8.0.11-el7-x86_64.tar.gz
[root@localhost data]# mv mysql-8.0.11-el7-x86_64 mysql

2、创建mysql用户
[root@localhost data]# useradd -M -s /sbin/nologin mysql

3、初始化数据库
[root@localhost data]# cd mysql/
[root@localhost mysql]# ./bin/mysqld --initialize --user=mysql --datadir=/data/mysql/data
2018-04-26T03:06:01.637456Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2018-04-26T03:06:01.637709Z 0 [System] [MY-013169] [Server] /data/mysql/bin/mysqld (mysqld 8.0.11) initializing of server in progress as process 53030

    2018-04-26T03:06:17.384428Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: *wbnbphswv8>K*此为数据库初始密码
    2018-04-26T03:06:26.959938Z 0 [System] [MY-013170] [Server] /data/mysql/bin/mysqld (mysqld 8.0.11) initializing of server has completed

4、编辑配置文件
[root@localhost mysql]# vim /etc/my.cnf
[client]
port      = 3306
socket    = /tmp/mysql.sock

    [mysqld]
    datadir=/data/mysql/data
    socket=/tmp/mysql.sock
    port=3306
    user=mysql
    basedir=/data/mysql
    symbolic-links=0

    [mysqld_safe]
    log-error=/data/mysql/data/error.log
    pid-file=/data/mysql/data/mysql.pid

5、启动
[root@localhost mysql]# ./bin/mysqld --defaults-file=/etc/my.cnf &
[1] 53216
[root@localhost mysql]# 2018-04-26T03:18:05.050872Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2018-04-26T03:18:05.051064Z 0 [System] [MY-010116] [Server] /data/mysql/bin/mysqld (mysqld 8.0.11) starting as process 53216
2018-04-26T03:18:06.208674Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2018-04-26T03:18:06.240611Z 0 [System] [MY-010931] [Server] /data/mysql/bin/mysqld: ready for connections. Version: '8.0.11'  socket: '/tmp/mysql.sock'  port: 3306  MySQL Community Server - GPL.

6、查看进程
[root@localhost mysql]# ps aux| grep mysql
qiang    10783  0.0  0.2 165020  4452 pts/0    S+   14:38   0:00 /data/mysql/bin/mysql -uroot -p
qiang    12866  0.0  0.0 112664   972 pts/1    R+   15:19   0:00 grep --color=auto mysql
root     14040  0.0  0.0 113252  1528 ?        S    8月07   0:00 /bin/sh /data/mysql/bin/mysqld_safe --datadir=/data/mysql/data --pid-file=/data/mysql/data/baobao.pid
mysql    14231  0.3 20.3 1365424 382536 ?      Sl   8月07  14:47 /data/mysql/bin/mysqld --basedir=/data/mysq --datadir=/data/mysql/data --plugin-dir=/data/mysql/lib/plugin --user=mysql --log-error=/data/mysql/data/mysql_error.log --pid-file=/data/mysql/data/baobao.pid --socket=/tmp/mysql.sock --port=13306

7、设置启动脚本
[root@localhost mysql]# cp ./support-files/mysql.server /etc/init.d/mysqld
修改启动参数
[root@localhost mysql]# vi /etc/init.d/mysqld
basedir=/data/mysql
datadir=/data/mysql/data

8、关闭与启动
停止
[root@localhost data]# /etc/init.d/mysqld stop
Shutting down MySQL... SUCCESS!
启动
[root@localhost ~]# /etc/init.d/mysqld start
Starting MySQL.... SUCCESS!

9、数据库简单设置
[root@localhost mysql]# ./bin/mysql -uroot -p
Enter password: wbnbphswv8>K
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.11

    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> show databases;
    ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
    mysql> alter user root@localhost identified by '123123';
    Query OK, 0 rows affected (0.14 sec)

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | sys                |
    +--------------------+
    4 rows in set (0.10 sec)

   mysql>  

对于以上mysql8.0.11安装、启动与基本设置操作方法相关内容,大家还有什么不明白的地方吗?或者想要了解更多相关,可以继续关注我们的行业资讯板块。

推荐阅读:
  1. Mongodb的安装,配置,启动与相关操作
  2. mongodb-2.0.5的安装与启动

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

mysql 安装

上一篇:Python编码规范(一)

下一篇:Kubernetes集群的节点和组件

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》