国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 數(shù)據(jù)庫(kù) > MySQL > 正文

centos 7下安裝mysql5.7

2024-07-24 13:00:29
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

#### 1、下載安裝包 http://dev.MySQL.com/downloads/mysql/#downloads 推薦下載通用安裝方法的TAR包

2.檢查庫(kù)文件是否存在,如有刪除。

[root@localhost Desktop]$ rpm -qa | grep mysqlmysql-libs-5.1.52-1.el6_0.1.x86_64[root@localhost ~]$ rpm -e mysql-libs-5.1.52.x86_64 --nodeps[root@localhost ~]$1234

3.檢查mysql組和用戶是否存在,如無(wú)創(chuàng)建。

[root@localhost ~]$ cat /etc/group | grep mysqlmysql:x:490:[root@localhost ~]$ cat /etc/passwd | grep mysqlmysql:x:496:490::/home/mysql:/bin/bash1234

以上為默認(rèn)存在的情況,如無(wú),執(zhí)行添加命令:

[root@localhost ~]$groupadd mysql[root@localhost ~]$useradd -r -g mysql mysql//useradd -r參數(shù)表示mysql用戶是系統(tǒng)用戶,不可用于登錄系統(tǒng)。123

4.解壓TAR包,更改所屬的組和用戶

[root@localhost ~]$ cd /usr/local/[root@localhost local]$ tar xvf mysql-5.7.12-linux-glibc2.5-x86_64.tar[root@localhost local]$ ls -ltotal 1306432-rwxr--r--. 1 root root 668866560 Jun 1 15:07 mysql-5.7.12-linux-glibc2.5-x86_64.tar-rw-r--r--. 1 7161 wheel 638960236 Mar 28 12:54 mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz-rw-r--r--. 1 7161 wheel 29903372 Mar 28 12:48 mysql-test-5.7.12-linux-glibc2.5-x86_64.tar.gz[root@localhost local]$ tar xvfz mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz[root@localhost local]$ mv mysql-5.7.12-linux-glibc2.5-x86_64 mysql[root@localhost local]$ ls -ltotal 1306436drwxr-xr-x. 2 root root 4096 Dec 4 2009 bindrwxr-xr-x. 2 root root 4096 Dec 4 2009 etcdrwxr-xr-x. 2 root root 4096 Dec 4 2009 gamesdrwxr-xr-x. 2 root root 4096 Dec 4 2009 includedrwxr-xr-x. 2 root root 4096 Dec 4 2009 libdrwxr-xr-x. 3 root root 4096 Dec 2 14:36 lib64drwxr-xr-x. 2 root root 4096 Dec 4 2009 libexecdrwxr-xr-x. 9 7161 wheel 4096 Mar 28 12:51 mysql-rwxr--r--. 1 root root 668866560 Jun 1 15:07 mysql-5.7.12-linux-glibc2.5-x86_64.tar-rw-r--r--. 1 7161 wheel 638960236 Mar 28 12:54 mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz-rw-r--r--. 1 7161 wheel 29903372 Mar 28 12:48 mysql-test-5.7.12-linux-glibc2.5-x86_64.tar.gzdrwxr-xr-x. 2 root root 4096 Dec 4 2009 sbindrwxr-xr-x. 6 root root 4096 Dec 2 14:36 sharedrwxr-xr-x. 2 root root 4096 Dec 4 2009 src[root@localhost local]$ chown -R mysql mysql/[root@localhost local]$ chgrp -R mysql mysql/[root@localhost local]$ cd mysql/12345678910111213141516171819202122232425262728

5.安裝和初始化數(shù)據(jù)庫(kù)

[root@localhost mysql]$ bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/2016-06-01 15:23:25 [WARNING] mysql_install_db is dePRecated. Please consider switching to mysqld --initialize2016-06-01 15:23:30 [WARNING] The bootstrap log isn't empty:2016-06-01 15:23:30 [WARNING] 2016-06-01T22:23:25.491840Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead2016-06-01T22:23:25.492256Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)2016-06-01T22:23:25.492260Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)123456

如果改變默認(rèn)安裝路徑,則需要 1)/etc/my.cnf、/etc/init.d/mysqld中修改 basedir=’/apps/mysql’ datadir=’/apps/mysql/data’ 2)創(chuàng)建ln mkdir -p /usr/local/mysql/bin ln -s /apps/mysql/bin/mysqld /usr/local/mysql/bin/mysqld


[root@localhost mysql]$[root@localhost mysql]$ cp -a ./support-files/my-default.cnf /etc/my.cnf[root@localhost mysql]$ cp -a ./support-files/mysql.server /etc/init.d/mysqld1234[root@localhost mysql]$ cd bin/[root@localhost bin]# ./mysqld_safe --user=mysql &[1] 2932[root@localhost bin]# 2016-06-01T22:27:09.708557Z mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'.2016-06-01T22:27:09.854913Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data12345[root@localhost bin]# /etc/init.d/mysqld restartShutting down MySQL..2016-06-01T22:27:50.498694Z mysqld_safe mysqld from pid file /usr/local/mysql/data/localhost.localdomain.pid ended SUCCESS! Starting MySQL. SUCCESS! [1]+ Done ./mysqld_safe --user=mysql[root@localhost bin]$ //設(shè)置開機(jī)啟動(dòng)[root@localhost bin]$ chkconfig --level 35 mysqld on[root@localhost bin]$123456789

6.初始化密碼

mysql5.7會(huì)生成一個(gè)初始化密碼,而在之前的版本首次登陸不需要登錄。

[root@localhost bin]$ cat /root/.mysql_secret # PassWord set for user 'root@localhost' at 2016-06-01 15:23:25 ,xxxxxR5H9[root@localhost bin]$./mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or /g.Your MySQL connection id is 2Server version: 5.7.12Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql> SET PASSWORD = PASSWORD('123456');Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)12345678910111213141516171819202122

7.添加遠(yuǎn)程訪問(wèn)權(quán)限

mysql> use mysql; Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> update user set host = '%' where user = 'root';Query OK, 1 row affected (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 0mysql> select host, user from user;+-----------+-----------+| host | user |+-----------+-----------+| % | root || localhost | mysql.sys |+-----------+-----------+//重啟生效

/etc/init.d/mysqld restart經(jīng)過(guò)以上處理,Mysql就可以正常啟動(dòng)使用了,但此時(shí)會(huì)存在大小寫敏感的問(wèn)題,需要進(jìn)行以下處理:

用root帳號(hào)登錄后,在/etc/my.cnf 中的[mysqld]后添加添加lower_case_table_names=1,重啟MYSQL服務(wù),這時(shí)已設(shè)置成功:不區(qū)分表名的大小寫; lower_case_table_names參數(shù)詳解: lower_case_table_names = 0 其中 0:區(qū)分大小寫,1:不區(qū)分大小寫 MySQL在Linux下數(shù)據(jù)庫(kù)名、表名、列名、別名大小寫規(guī)則是這樣的:    1、數(shù)據(jù)庫(kù)名與表名是嚴(yán)格區(qū)分大小寫的;    2、表的別名是嚴(yán)格區(qū)分大小寫的;    3、列名與列的別名在所有的情況下均是忽略大小寫的;    4、變量名也是嚴(yán)格區(qū)分大小寫的; 


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 夏津县| 南乐县| 柘城县| 旺苍县| 南宁市| 罗源县| 五原县| 屯留县| 格尔木市| 怀柔区| 阳江市| 阿拉善盟| 洛隆县| 理塘县| 聂拉木县| 铜川市| 花垣县| 虎林市| 韩城市| 故城县| 合阳县| 杭锦旗| 抚州市| 绥化市| 安龙县| 炉霍县| 阿克陶县| 武鸣县| 梨树县| 广饶县| 同德县| 保德县| 团风县| 黄冈市| 定远县| 广西| 麦盖提县| 高淳县| 博客| 竹北市| 乌拉特中旗|