mysql8.0.11安装、启动与基本设置
此次演示的是mysql 8.0.11的安装、启动与基本设置。 下载mysql-8.0.11-el7-x86_64.tar.gz1、解压并重命名
# cd /data
# ls
mysql-8.0.11-el7-x86_64.tar.gz
# tar -zxf mysql-8.0.11-el7-x86_64.tar.gz
# mv mysql-8.0.11-el7-x86_64 mysql
2、创建mysql用户
# useradd -M -s /sbin/nologin mysql
3、初始化数据库
# cd mysql/
# ./bin/mysqld --initialize --user=mysql --datadir=/data/mysql/data
2018-04-26T03:06:01.637456Z 0 '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> 2018-04-26T03:06:01.637709Z 0 /data/mysql/bin/mysqld (mysqld 8.0.11) initializing of server in progress as process 53030
2018-04-26T03:06:17.384428Z 5 A temporary password is generated for root@localhost: *wbnbphswv8>K*此为数据库初始密码 2018-04-26T03:06:26.959938Z 0 /data/mysql/bin/mysqld (mysqld 8.0.11) initializing of server has completed
4、编辑配置文件
# vim /etc/my.cnf
port = 3306
socket = /tmp/mysql.sock
datadir=/data/mysql/data
socket=/tmp/mysql.sock
port=3306
user=mysql
basedir=/data/mysql
symbolic-links=0
log-error=/data/mysql/data/error.log
pid-file=/data/mysql/data/mysql.pid
5、启动
# ./bin/mysqld --defaults-file=/etc/my.cnf &
53216
# 2018-04-26T03:18:05.050872Z 0 '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> 2018-04-26T03:18:05.051064Z 0 /data/mysql/bin/mysqld (mysqld 8.0.11) starting as process 53216
2018-04-26T03:18:06.208674Z 0 CA certificate ca.pem is self signed.
2018-04-26T03:18:06.240611Z 0 /data/mysql/bin/mysqld: ready for connections. Version: '8.0.11'socket: '/tmp/mysql.sock'port: 3306MySQL Community Server - GPL.
6、查看进程
# ps aux| grep mysql
qiang 107830.00.2 1650204452 pts/0 S+ 14:38 0:00 /data/mysql/bin/mysql -uroot -p
qiang 128660.00.0 112664 972 pts/1 R+ 15:19 0:00 grep --color=auto mysql
root 140400.00.0 1132521528 ? S 8月07 0:00 /bin/sh /data/mysql/bin/mysqld_safe --datadir=/data/mysql/data --pid-file=/data/mysql/data/baobao.pid
mysql 142310.3 20.3 1365424 382536 ? Sl 8月0714: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、设置启动脚本
# cp ./support-files/mysql.server /etc/init.d/mysqld
修改启动参数
# vi /etc/init.d/mysqld
basedir=/data/mysql
datadir=/data/mysql/data
8、关闭与启动
停止
# /etc/init.d/mysqld stop
Shutting down MySQL... SUCCESS!
启动
# /etc/init.d/mysqld start
Starting MySQL.... SUCCESS!
9、数据库简单设置
# ./bin/mysql -uroot -p
Enter password: wbnbphswv8>K
Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection> 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>
mysql>> 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>
页:
[1]