linux下安裝mysql5.6.26
1.環境描述
安裝時用的Linux為rhel6.3 x86_64,用的MySQL為mysql5.6.26 x86_64,下載地址:www.oracle.com
安裝方式為rpm二進位制安裝,所需要的兩個mysql rpm安裝包為:
MySQL-server-5.6.26-1.el6.x86_64.rpm
MySQL-client-5.6.26-1.el6.x86_64.rpm
上面的兩個安裝包也可以從以下的地址下載:
http://download.csdn.net/detail/jiaping0424/9503594
http://download.csdn.net/detail/jiaping0424/9503595
關於這兩個包的作用和關係自己百度吧,這裡不再贅述。
利用rpm二進位制安裝方式來安裝mysql過程非常簡單,rpm命令在安裝時常用的引數是-hiv,其中i表示將安裝指定的rmp軟體包,v表示輸出安裝時的詳細資訊,h表示在安裝期間出現“#”號來顯示目前的安裝進度。
2.檢查並解除安裝已經存在的mysql
如果安裝前系統已經存在相關元件,則在安裝時會報衝突相關錯誤,這裡避免報錯先解除安裝與mysql相關的元件。
2.1.檢查
[root@web1 ~]# rpm -qa|grep mysql
mysql-libs-5.1.61-4.el6.x86_64
[root@web1 ~]#
2.2.解除安裝
[root@web1 ~]# rpm -e --nodeps mysql-libs-5.1.61-4.el6.x86_64
[root@web1 ~]# rpm -qa|grep mysql
[root@web1 ~]#
3.安裝mysql server和client
[root@web1 ~]# rpm -hiv MySQL-server-5.6.26-1.el6.x86_64.rpm
warning: MySQL-server-5.6.26-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1 f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
[root@web1 ~]# rpm -hiv MySQL-client-5.6.26-1.el6.x86_64.rpm
warning: MySQL-client-5.6.26-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
[root@web1 ~]#
4.拷貝並修改配置檔案
[root@web1 ~]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
5.初始化MySQL及設定密碼
[root@web1 ~]# /usr/bin/mysql_install_db
[root@web1 ~]# service mysql start
Starting MySQL.[確定]
[root@web1 ~]#
檢視root賬號密碼
[[email protected] ~]# cat /root/.mysql_secret
# The random password set for the root user at Fri Apr 22 00:52:07 2016 (local time): 3IYLCgGex2Y7KWvR
[[email protected] ~]#
利用上面的密碼登入:
[[email protected] ~]# mysql -uroot -p3IYLCgGex2Y7KWvR
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 1
Server version: 5.6.26
Copyright (c) 2000, 2015, 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>
修改密碼為123456:
mysql> SET PASSWORD = PASSWORD('123456');
Query OK, 0 rows affected (0.02 sec)
mysql> exit
Bye
再用新密碼登入:
[[email protected] ~]# mysql -uroot -p123456
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 2
Server version: 5.6.26 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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>
6.允許遠端登陸
[[email protected] ~]# mysql -uroot -p123456
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 3
Server version: 5.6.26 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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>
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host,user,password from user;
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| web1 | root | *5B4AC10888F4F9D9A8CD55A78EF1EA2D0322B013 |
| 127.0.0.1 | root | *5B4AC10888F4F9D9A8CD55A78EF1EA2D0322B013 |
| ::1 | root | *5B4AC10888F4F9D9A8CD55A78EF1EA2D0322B013 |
+-----------+------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql> update user set password=password('123456') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 4 Changed: 3 Warnings: 0
mysql> update user set host='%' where user='root' and host='localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[[email protected] ~]#
7.設定開機自啟動
[root@web1 ~]# chkconfig mysql on
[root@web1 ~]# chkconfig --list | grep mysql
mysql 0:關閉 1:關閉 2:啟用 3:啟用 4:啟用 5:啟用 6:關閉
[root@web1 ~]#
8.MySQL的預設安裝位置
/var/lib/mysql/ #資料庫目錄
/usr/share/mysql #配置檔案目錄
/usr/bin #相關命令目錄
/etc/init.d/mysql #啟動指令碼
9.修改字符集和資料儲存路徑
配置/etc/my.cnf檔案、修改資料存放路徑、mysql.sock路徑以及預設編碼utf-8
[[email protected] ~]# vi /etc/my.cnf
[client]
password = 123456
port = 3306
default-character-set=utf8
[mysqld]
port = 3306
character_set_server=utf8
character_set_client=utf8
collation-server=utf8_general_ci
#(注意linux下mysql安裝完後是預設:表名區分大小寫,列名不區分大小寫; 0:區分大小寫,1:不區分大小寫)
lower_case_table_names=1
#(設定最大連線數,預設為 151,MySQL伺服器允許的最大連線數16384; )
max_connections=1000
[mysql]
default-character-set = utf8
10.檢視字符集
show variables like '%collation%';
show variables like '%char%';
注:為了使部落格更加完善,便於更好的分享,請讀者為文章中的錯誤進行指正,博主會定期更正,謝謝!
Keep fighting.
Warrior
2016.4.27
– The End –
相關推薦
linux下安裝mysql5.6.26
1.環境描述 安裝時用的Linux為rhel6.3 x86_64,用的MySQL為mysql5.6.26 x86_64,下載地址:www.oracle.com 安裝方式為rpm二進位制安裝,所需要的兩個mysql rpm安裝包為: MySQL-serv
linux下安裝mysql5.6步驟
這裡我們記錄下在實際工作中安裝的mysql5.6版本的步驟,在安裝過程中會遇到了一些問題,這裡我們也記錄下來,進行總結吧!! 文章目錄 1.mysql安裝 1.1.上傳 mysql5.6包到要安裝的伺服器 1.2. 安裝mys
Linux下安裝mysql5.6.42報錯處理解決辦法
linux下安裝mysql的教程炒雞多,我就不寫了,自行百度。 說一下我今天安裝遇到的問題: 1、執行 ./scripts/mysql_install_db --user=mysql 後 報 FATAL
linux下安裝mysql5.6
安裝mysql5.61、準備yumwget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm rpm -ivh mysql-c
阿里雲Linux下安裝MySql5.6、5.7、8.0版本和解除安裝以及遠端連線
在安裝的時候參考了很多部落格,但是發現還是 MySql的官網給的步驟最有效,最權威。 適合: Debian 7,8,9 Ubuntu 14.04,16.04,17.10,18.04 下面記錄下我安裝的步驟: 1,新增 MySQL APT儲存庫 首先我們需要
Linux(CentOS-7.0)下安裝MySQL5.6.22
轉載請註明,原創地址:點選開啟連結 http://blog.csdn.net/u010587274/article/details/50969821一 安裝環境(1)CentOS版本:CentOS-7.0檢視方法:[[email protected] ~]
LINUX下MySQL 5.6.26 二進位制安裝
1.前言 MySQL有三種安裝方式:RPM安裝、二進位制包安裝、原始碼包安裝。這3種種方式各有特色,主要特點參考下表。實際應用中,可以根據你所用的主機環境進行優化,選擇最佳的配置值,安裝定製更
Linux下MySQL-5.6.26 RPM包安裝
1.前言 本文測試環境: CentOS release 6.4(Linux version 2.6.32-358.el6.x86_64) MySQL-5.6.26 RPM包下載地址:http://
centos6.7下安裝mysql5.6.22同時解決中文亂碼問題
系統服務 iptable nod -- 1.7 亂碼問題 dport 5.6 復制 1.下載 http://dev.mysql.com/downloads/mysql/ 或者使用wget下載: wget http://dev.mysql.com/get/Do
linux下安裝mysql5.7.17及簡單配置
http mkdir exp 重要 ble ges 選擇 bsp 統一 1.mysql5.7.17安裝在/usr/local/mysql目錄裏面,也可以安裝在其他地方 (安裝包最好與Linux系統一樣,eg;64位的就是“mysql-5.7.17-linux-glibc2.
Linux下安裝Python3.6和第三方庫
python安裝一、安裝Python-3.6.2.tgz安裝依賴環境最小化安裝Redhat6.4環境下yum -y install gcc make zlib-devel bzip2-devel ncurses-devel readline-devel(yum -y install gcc mak
linux下安裝python3.6
20px ons fff tran parent href 3.6 tps watermark linux操作 (?? . ??)以後就可以使用 pip36 python36來進行操作。如果在命令行中輸入scrapy提示沒這個命令,可以試試python36 -m scrap
linux上安裝 mysql5.6
char 解壓 ice 看不見 操作 date chmod use table 1. 創建用戶及組 cd / groupadd mysql useradd -g mysql mysql passwd mysql chown -R mysql:mysql /usr/local
linux 下安裝Mysql5.7以後版本後不知道密碼如何登陸
linux 下安裝Mysql5.7以後版本後不知道密碼如何登陸 第一次在linux下安裝mysql,安裝成功以後不知道密碼無法登陸,看了好多部落格說初始密碼為空,然而並不是這樣,輸入空密碼會報錯,後來才知道和版本有關。5.7之前的版本預設是沒有密碼的,只需在伺服器上直接登入,甚至使用者名
centos7下安裝Mysql5.6(yum方式)
參考部落格:[阿里雲Centos7使用yum安裝MySQL5.6] (https://blog.csdn.net/u011627980/article/details/52691799) 一、安裝 大家都知道,centos自帶的repo是不會自動更新每個軟體的最新版本,所以無法通
centos7下安裝Mysql5.6(原始碼方式)
Mysql安裝和配置 我使用原始碼編譯的形式來安裝mysql,使用的mysql5.6。 1.下載 wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.40.tar.gz 2.解除安裝自帶mysql 因為mys
Centos7安裝MySQL5.6.26
一,解除安裝自帶MySQL yum remove -y mysql mysql-devel mysql-server 二,安裝MySQL-5.6.26 [[email protected] ~]# cd /usr/src/ [[email protected] src]#&nbs
linux 下安裝 Python3.6
第一步: 下載Python包 第一種方式:如果linux虛擬機器有網的話,可以直接 wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0a1.tar.xz
linux下安裝mysql5.7
在linux(centos)下有2種方式安裝,第一種使用rpm安裝在網上可以搜到,第二種使用壓縮包方式,我這裡是採用壓縮包方式。 1.這裡我將mysql安裝在/usr/local/mysql目錄裡面,也可以安裝在其他地方 mkdir /usr/local/mysql
Centos7下安裝mysql5.6
由於最近專案要求需要在centos7上安裝MySQL5.6,從網上查了很多資料,並且自己也嘗試了安裝mariadb,但是他的版本是5.5的。公司要做主從複製,這個5.5好像不支援,需要5.6的。所以只能嘗試各種方法。終於被我試出來了。