Mysql 5.7.21 install for Linux
Mysql 5.7.21 install for Linux
一:下載
二:安裝前準備
三:安裝
一:下載
1 下載地址
dev.mysql.com/downloads/mysql
2 安裝包
mysql-5.7.21-linux-glibc2.12-x86_64.tar
二:安裝前準備
1 解除安裝系統預設安裝的mysql(謹慎操作)
[root@rac1 bin]# rpm -qa|grep mysql
[root@rac1 bin]# rpm -e mysql-connector-odbc-5.1.5r1144-7.el6.x86_64 --nodeps
[root@rac1 bin]# rpm -e mysql-devel-5.1.66-2.el6_3.x86_64 --nodeps
[root@rac1 bin]# rpm -e mysql-5.1.66-2.el6_3.x86_64 --nodeps
[root@rac1 bin]# rpm -e mysql-libs-5.1.66-2.el6_3.x86_64 --nodeps
[root@rac1 bin]# rpm -e mysql-server-5.1.66-2.el6_3.x86_64 --nodeps
......
2 建立mysql使用者和組
[root@rac1 bin]# groupadd mysql
[root@rac1 bin]# useradd -g mysql mysql
[root@rac1 bin]# id mysql
uid=493(mysql) gid=5006(mysql) groups=5006(mysql)
[root@rac1 bin]# passwd mysql
三:安裝
1 解壓
[root@rac1 mysql]# cd /package/mysql/
[root@rac1 mysql]# ll -rth
total 641M
-rw-r--r-- 1 root root 641M Jun 4 10:22 mysql-5.7.21-linux-glibc2.12-x86_64.tar
[root@rac1 mysql]# tar -xvf mysql-5.7.21-linux-glibc2.12-x86_64.tar
mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
mysql-test-5.7.21-linux-glibc2.12-x86_64.tar.gz
[root@rac1 mysql]# ll -rth
total 1.3G
-rw-r--r-- 1 7161 31415 28M Dec 28 12:18 mysql-test-5.7.21-linux-glibc2.12-x86_64.tar.gz
-rw-r--r-- 1 7161 31415 613M Dec 28 12:20 mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
-rw-r--r-- 1 root root 641M Jun 4 10:22 mysql-5.7.21-linux-glibc2.12-x86_64.tar
[root@rac1 mysql]# tar -zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
[root@rac1 mysql]# du -sh mysql-5.7.21-linux-glibc2.12-x86_64
2.5G mysql-5.7.21-linux-glibc2.12-x86_64
[root@rac1 mysql]# cp -r mysql-5.7.21-linux-glibc2.12-x86_64 /usr/local/mysql
[root@rac2 etc]# chown mysql.mysql /usr/local/mysql -R
2 建立my.cnf
[root@rac1 ~]# cd /etc/
[root@rac1 etc]# touch my.cnf
[root@rac1 etc]# vi my.cnf
[mysqld]
datadir=/usr/local/mysql/data
log-error=/usr/local/mysql/data/error.log
pid-file=/usr/local/mysql/data/mysql.pid
socket=/usr/local/mysql/mysql.sock
user=mysql
tmpdir=/tmp
3 配置mysqld命令
[root@rac1 etc]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@rac1 etc]# chmod 755 /etc/init.d/mysqld
[root@rac1 etc]# vi /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data/mysql
4 開始安裝
[mysql@rac1 mysql]$ pwd
/usr/local/mysql
[mysql@rac1 mysql]$ ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/mysql.pid --tmpdir=/tmp
[mysql@rac1 data]$ service mysqld status
MySQL is not running [FAILED]
[mysql@rac1 data]$ service mysqld start
Starting MySQL.. [ OK ]
5 mysql.sock
[mysql@rac1 bin]$ ./mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[mysql@rac1 bin]$ ln -s /usr/local/mysql/mysql.sock /tmp/mysql.sock
6 登入mysql並修改密碼
[mysql@rac1 data]$ pwd
/usr/local/mysql/data
[mysql@rac1 data]$ vi error.log
2018-06-04T03:51:14.789564Z 1 [Note] A temporary password is generated for root@localhost: k7deH1nLvo_N
[mysql@rac1 bin]$ ./mysql -uroot -p'k7deH1nLvo_N'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.21
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 '123';
Query OK, 0 rows affected (0.10 sec)
[mysql@rac1 bin]$ ./mysql -uroot -p123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.21 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.19 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-2155537/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL 5.7.21 Linux平臺安裝 Part 2MySqlLinux
- Linux 安裝mysql 5.7.21 可能遇到的問題歸類LinuxMySql
- MySQL5.7.21免安裝版如何配置MySql
- mysql 5.7.21 CMake Error: The source directory "/data/server/mysql" does not appear to contain CMakMySqlErrorServerAPPAI
- Mysql 5.7.22 install for windowsMySqlWindows
- Install MySQL 5.7 in the DockerMySqlDocker
- MySQL5.7.21解壓版安裝詳細教程MySql
- yum install mysql5.7MySql
- linux之--install超時Linux
- 02. Install redis on LinuxRedisLinux
- 透過yum在centos6.6上安裝mysql5.7.21rpm包CentOSMySql
- Install linux mint apt to Ubuntu 18.04 LTSLinuxAPTUbuntu
- Linux下python pip install失敗LinuxPython
- install java javac on kali linux, raspberry piJavaLinux
- SQLServer2017_Install_for_CentOS Linux release 7.5SQLServerCentOSLinux
- Oracle Linux 7.1 silent install 19cOracleLinux
- 報錯install_driver(mysql) failed: Attempt to reload DBD/mysql.pmMySqlAI
- Oracle Linux 7.1 silent install 19C RACOracleLinux
- 安裝MySQL5.7報錯:The action ‘Install’ for product ‘MySQL Server 5.7.19’ failed.MySqlServerAI
- linux下使用npm install報EACCES的解決方法LinuxNPM
- Linux安裝Redis 6.0.5 ./install_server.sh報錯LinuxRedisServer
- Windows下Mysql 5.7.21(Zip)的安裝配置以及初始密碼報錯的問題簡單總結WindowsMySql密碼
- go install: no install location for directory outside GOPATHGoIDE
- semantic-ui@2.4.2 install: `gulp install`UI
- pip install 提示:Could not install packages due to an EnvironmentErrorPackageError
- 如何處理錯誤訊息Please install the Linux kernel header filesLinuxHeader
- install qdrant
- Install clickhouse
- habitat install
- Python:conda install 和pip install的區別Python
- mysql安裝 for LinuxMySqlLinux
- Linux安裝MySQLLinuxMySql
- before install octave package you must be install gcc-fortranPackageGC
- 【mysql】linux下安裝mysql-5.7.31MySqlLinux
- mvn install 命令
- KubeSphere 3.3.2 install
- kubernetes 1.25.9 install
- openwrt install lsblk