Linux下安装-配置-mysql-5.7.13
當前linux版本?AliCloud Linux 4.4.6-3 ?
{ ? ? 具體路徑自行修改 ? ? }
1.準備安裝包mysql-5.7.13 ? (官網地址: ? ?http://dev.mysql.com/downloads/mysql/ ? )(低版本的不知道還有沒有)
2.?添加一個mysql組 (命令)
[root@localhost ~]# groupadd mysql
3.添加一個用戶mysql
[root@localhost ~]# useradd -g mysql mysql
4.解壓tar包(文件 在/usr/tmp中解壓)
[root@localhost tmp]#?tar -xzvf mysql-5.7.13.tar.gz
5 然后?重命名?解壓后的包 ?,命名為mysql
[root@localhost tmp]# mv?mysql-5.7.13 mysql
6. 查看tmp臨時包 移動 mysql包到usr/local 中
[root@localhost tmp]# mv /mysql /usr/loca/
7. cd進入mysql中?給這個包授權 給mysql用戶
[root@localhost?tmp]# cd /usr/local/mysql
[root@localhost mysql]# chown –R mysql .
[root@localhost mysql]#?chgrp –R mysql .
8.?配置參數 (?basedir 為mysql 的路徑, datadir 為mysql的 data 包,里面存放著mysql自己的包)
[root@localhost?mysql]#?bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
9.記住臨時密碼(最后的密碼)
2017-01-05T05:07:26.637535Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-01-05T05:07:28.754579Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-01-05T05:07:28.962679Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-01-05T05:07:29.080754Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: db1cd080-d304-11e6-91bb-00163e047c4a.
2017-01-05T05:07:29.083708Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-01-05T05:07:29.086486Z 1 [Note] A temporary password is generated for root@localhost: K07xmF?pX%Gh
? ? 然后執行
[root@localhost?mysql]#?#bin/mysql_ssl_rsa_setup --datadir=/data/mysql
10. ?cd到當前?/support-files 下 ,復制兩個文件 到 etc 和/etc/init.d/ 下
11、[root@localhost?support-files]#?cp my-default.cnf /etc/my.cnf
12、[root@localhost?support-files]#?cp mysql.server /etc/init.d/mysql
13.?修改basedir= ?自己的路徑 ? ? 修改datadir= 自己的路徑?
(本人:? basedir=/usr/local/mysql ? ? ? ? ? ?? bindir=/usr/local/mysql/bin)
[root@localhost?support-files]#?vim /etc/init.d/mysql?
14.?啟動mysql ?(如果不行可以使用命令: service mysql start ?啟動)?
[root@localhost?mysql]#?bin/mysqld_safe --user=mysql & ??
15. 登錄(輸入臨時密碼 注意大小寫),登錄后提示歡迎語,?
[root@localhost mysql]# bin/mysql --user=root -p
Enter password:?
Welcome to the MySQL monitor. ?Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.13
Copyright (c) 2000, 2016, 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.
16.在 sqlplus 命令行下修改密碼?
mysql>set password=password('123456');
授權
mysql>grant all privileges on *.* to root@'%' identified by '123456';
刷新
mysql>flush privileges;
mysql>use mysql;
mysql>select host,user from user;
................................查看完畢 此后隨意........................
總結
以上是生活随笔為你收集整理的Linux下安装-配置-mysql-5.7.13的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【深度学习】60题PyTorch简易入门
- 下一篇: 【Python】Python一行代码能做