Ubuntu 12.04下安裝MySQL圖解
轉載地址:http://blog.csdn.net/eddie_520/article/details/23447247
因為Ubuntu Server上 wget比較慢,所以我是直接在windows用迅雷下載好,然後WinSCP上傳到伺服器的,看各自喜好了。
上正題。
包放在~/Download目錄下,全部安裝命令如下:
1、解壓tar.gz
tar –xzf mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz
2、重新命名解壓資料夾
mv mysql-5.6.10-linux-glibc2.5-x86_64 mysql
3、將mysql資料夾移動到/usr/local目錄下
sudo mv ~/下載/mysql /usr/local
4、進入mysql目錄
cd /usr/local/mysql
5、增加mysql使用者組
sudo groupadd mysql
6、增加mysql使用者
sudo useradd -r -g mysql mysql
7、將mysql資料夾own及grp變更為mysql
sudo chown -R mysql .
sudo chgrp -R mysql .
8、執行mysql安裝指令碼
sudo scripts/mysql_install_db --user=mysql
(若未安裝libaio包,會有一個報錯提示,安裝libaio-dev後,再執行指令碼即可。如果還是出錯可以刪除rm -rf /etc/my.cnf)
sudo apt-get install libaio-dev
9、將目錄許可權變更回來,僅保留data目錄為mysql使用者
sudo chown -R root .
sudo chown -R mysql data
10、將mysql配置檔案拷貝到etc目錄(全域性配置)
注意:5.6版本的預設配置檔名稱由原先的my-medium變更為了my-default。
sudo cp support-files/my-default.cnf /etc/my.cnf
11、啟動mysql
sudo bin/mysqld_safe --user=mysql &
12、初始化mysql root使用者密碼
sudo bin/mysqladmin -u root password '密碼文字'
#ps -A|grep mysql
顯示類似:
1829 ? 00:00:00 mysqld_safe
1876 ? 00:00:31 mysqld
2.#kill -9 1829
3.#kill -9 1876
13、複製mysql.server指令碼到/etc/init.d(初始化服務,有些人喜歡改成mysqld,在這裡改就可以)
sudo cp support-files/mysql.server /etc/init.d/mysql.server
14、檢視mysql執行狀態
sudo service mysql.server status
如果執行正常,會顯示 MySQL running。
如果顯示 not running,應該是前面沒有啟動服務,可直接用service mysql.server start啟動
sudo service mysql.server [status|start|stop]
15、讓mysql開機啟動[defaults],取消開機啟動[remove]
sudo update-rc.d -f mysql.server defaults [remove]
16、將mysql/bin/mysql命令加入到使用者命令中,或將mysql/bin目錄加入path
加入使用者命令:
sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
加入環境變數:
export PATH=$PATH:/usr/local/mysql/bin
17、允許root使用者遠端登入
1>進入mysql: mysql –u root –p
2>改變資料庫: use mysql;
3>從任意主機登入: grant all privileges on *.* to [email protected]"%" identified by "密碼文字" with grant option;
4>從指定主機登入: grant all privileges on *.* to [email protected]"192.168.1.101" identified by "passw0rd" with grant option;
5>授權生效: flush privileges;
6>檢視host為%授權是否新增: select * from user;
7>檢視資料庫字符集: show variables like 'character%';
啟動完mysql後,我們接著可以測試一下,使用“mysql”命令來進入mysql資料庫的控制檯
$mysql -u root
在這裡之所以用-u root是因為我現在是一般使用者(firehare),如果不加-u root的話,mysql會以為是firehare在登入。注意,我在這裡沒有進入根使用者模式,因為沒必要。一般來說,對mysql中的資料庫進行操作,根本沒必要進入根使用者模式,只有在設定時才有這種可能。
進入mysql之後,最要緊的就是要設定Mysql中的root使用者密碼了,否則,Mysql服務無安全可言了。
mysql> GRANT ALL PRIVILEGES ON *.* TO [email protected] IDENTIFIED BY "123456";
如果需要使用root從其他機器遠端訪問可以使用
mysql> GRANT ALL PRIVILEGES ON *.* TO [email protected]“%” IDENTIFIED BY "123456";
注意,我這兒用的是123456做為root使用者的密碼,但是該密碼是不安全的,請大家最好使用大小寫字母與數字混合的密碼,且不少於8位。
配置檔案參考:
- <spanstyle="background-color: rgb(255, 255, 255);"># For advice on how to change settings please see
- # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
- # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
- # *** default location during install, and will be replaced if you
- # *** upgrade to a newer version of MySQL.
- [client]
- port = 3306
- default-character-set=utf8
- # Here is entries for some specific programs
- # The following values assume you have at least 32M ram
- [mysqld]
- character_set_server=utf8
- lower_case_table_names=1
- init_connect='SET NAMES utf8'
- lower_case_table_names=1
- max_connections=3000
- max_allowed_packet = 32M
- thread_cache_size = 16
- thread_concurrency = 8
- query_cache_size = 128M
- # Remove leading # and set to the amount of RAM for the most important data
- # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
- # innodb_buffer_pool_size = 128M
- # Remove leading # to turn on a very important data integrity option: logging
- # changes to the binary log between backups.
- # log_bin
- # These are commonly set, remove the # and set as required.
- # basedir = .....
- # datadir = .....
- # port = .....
- # server_id = .....
- # socket = .....
- # Remove leading # to set options mainly useful for reporting servers.
- # The server defaults are faster for transactions and fast SELECTs.
- # Adjust sizes as needed, experiment to find the optimal values.
- join_buffer_size = 16M
- sort_buffer_size = 16M
- # read_rnd_buffer_size = 2M
- sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
- [mysqldump]
- quick
- quote-names
- max_allowed_packet = 32M
- [mysql]
- no-auto-rehash </span>
- <spanstyle="background-color: rgb(255, 255, 255);"># For advice on how to change settings please see
- # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
- # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
- # *** default location during install, and will be replaced if you
- # *** upgrade to a newer version of MySQL.
- [client]
- port = 3306
- default-character-set=utf8
- # Here is entries for some specific programs
- # The following values assume you have at least 32M ram
- [mysqld]
- character_set_server=utf8
- lower_case_table_names=1
- init_connect='SET NAMES utf8'
- lower_case_table_names=1
- max_connections=3000
- max_allowed_packet = 32M
- thread_cache_size = 16
- thread_concurrency = 8
- query_cache_size = 128M
- # Remove leading # and set to the amount of RAM for the most important data
- # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
- # innodb_buffer_pool_size = 128M
- # Remove leading # to turn on a very important data integrity option: logging
- # changes to the binary log between backups.
- # log_bin
- # These are commonly set, remove the # and set as required.
- # basedir = .....
- # datadir = .....
- # port = .....
- # server_id = .....
- # socket = .....
- # Remove leading # to set options mainly useful for reporting servers.
- # The server defaults are faster for transactions and fast SELECTs.
- # Adjust sizes as needed, experiment to find the optimal values.
- join_buffer_size = 16M
- sort_buffer_size = 16M
- # read_rnd_buffer_size = 2M
- sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
- [mysqldump]
- quick
- quote-names
- max_allowed_packet = 32M
- [mysql]
- no-auto-rehash </span>
相關推薦
Ubuntu 12.04下安裝MySQL圖解
轉載地址:http://blog.csdn.net/eddie_520/article/details/23447247 因為Ubuntu Server上 wget比較慢,所以我是直接在windows用迅雷下載好,然後WinSCP上傳到伺服器的,看各自喜好了。 上正題。
Linux Ubuntu 12.04 下安裝mysql 以及建立 遠端navicat 連線
安裝過程中需要用到的linux 命令: 1:sudo **** 以sudo 開頭的程式碼 表示 是以管理員執行 2:chmod 777 ***(*號代表檔名) 當你不是以ROOT許可權進入Ubuntu 的話 更改檔案配置 需要修改檔案的 許可權級別,777 代表最高
Ubuntu 12.04下安裝mysql 5.5.28版本執行此命令時,缺少 libaio.so.1
在Ubuntu 12.04下安裝mysql 5.5.28版本執行此命令時,會提示如下錯誤的資訊: 執行 ./scripts/mysql_install_db 時出錯。 ./bin/mysqld: error while loading shared libraries:
ubuntu 16.04下安裝 mysql-connector-c-6.1.11-linux-glibc2.12-x86_64.tar.gz
最近在玩MySQL,就想著用c語言去連結資料庫,看了網上的c語言連結資料的例子,怎麼也執行不了; 網上說要安裝一個庫,如下: 安裝:sudo apt-get install libmysqlclient-dev 不知道是不是我電腦的原因,這種裝過以後報了錯誤,好像是:mysql-com
Ubuntu 16.04下安裝MySQL 以及C++連線MySQL
一、簡單分享Ubuntu 16.04下安裝MySQL的過程。 首先執行下面三條命令: sudo apt-get install mysql-server sudo apt isntall mysql-client sudo apt install libmysqlcl
Ubuntu 12.04上安裝MySQL並執行
Ubuntu 12.04上安裝MySQL並執行 作者:凱魯嘎吉 - 部落格園 http://www.cnblogs.com/kailugaji/ 安裝MySQL資料庫 sudo apt-get update sudo apt-get install mysql-serve
Ubuntu 12.04 下安裝 Eclipse
$ sudo apt-get install eclipse 方法二:(優點是安裝內容清爽,缺點是配置麻煩) 1、安裝JDK,參考 Ubuntu 12.04 下安裝 JDK 7 2、下載 Eclipse 從 http://www.eclipse.org/downloads/index-develo
Ubuntu 12.04下安裝vim, 簡單配置與基本使用介紹
ubuntu12.04預設沒有安裝vim,執行命令會出現以下錯誤: [email protected]:~$ vim test1.c The program 'vim' can be found in the following packages: * vi
Ubuntu 12.04下安裝VMware Tools遇到的問題
exception: VMware Tools installation fails when Easy Install is in progress (1017687) 在VMware下安裝Ubuntu,那麼必須安裝VMware-tools,才能獲得更好的體驗,包括螢幕解析度、聲音、和window
Angularjs學習---angularjs環境搭建,ubuntu 12.04下安裝nodejs、npm和karma
1.下載angularjs 2.示例1 HelloWorld ! 新建一個helloworld.html <!doctype html> <html ng-app> <head> <script src><
ubuntu 12.04下安裝軟體報“在處理時有錯誤發生”解決方案
今天剛裝完ubuntu 12.04,想安裝Chrome瀏覽器,在《Ubuntu軟體中心》沒有找到,只有Chromium,於是就先Googling了一下,有人說先在:“直接去官網下的安裝不了,得要先在《Ubuntu軟體中心》安裝Chromium之後,再安裝Chrome,最後再
Ubuntu 12.04下安裝Gstreamer
一. Gstreamer安裝:方法一:使用sudo apt-get install 安裝sudoapt-get install libgstreamer0.10-dev gstreamer-tools gstreamer0.10-toolsgstreamer0.10-docs
Ubuntu 16.04下安裝MySQL
在Ubantu上安裝Mysql折騰了不少時間,記錄一下方便以後回顧。 1.首先執行下面三條命令: sudo apt-get install mysql-server sudo apt isntall mysql-client sudo apt insta
五:在Ubuntu 16.04下安裝MySQL
1,首先執行下面三條命令: 執行第一條命令: sudo apt-get install mysql-server 如下圖: 輸入 y ,下載安裝時會出現要求設定密碼的介面: 輸入自己想設定的密碼,之後再次輸入確認密碼。 完成之後如下圖: 執行第二條命
Ubuntu 12.04下swift的單節點部署安裝
由於課題需要,現開始進行對openstack的研究,現在網上對於swift安裝有很多教程,有成功的,有失敗的,現將我的心得告訴大家,方便大家的使用 1.首先安裝GIT 1.1有人推薦使用 sudo apt-get install git
Ubuntu 12.04下fcitx安裝谷歌搜狗輸入法
原址:yanue.net/post-110.html 在網上找了好多Ubuntu12.04安裝搜狗輸入法的帖子,總是不太全面,不能達到正確安裝使用搜狗輸入法的目的, 使用上面兩個帖子綜合了一下,終於安裝成功。 我遇到的問題是:安裝完搜狗輸入法以後,在system set
ubuntu 12.04下搭建web伺服器(MySQL+PHP+Apache) 教程
1.開始說明 下面很多可能參照網上其中以為前輩的,但有所改進吧。這些設定可能會有所不同,你需要根據不同情況進行修改。 安裝apache2 2.切換管理員身份 在ubuntu中需要用root身份進行操作,所以用下面的命令確保以root身份登入: sudo su
ubuntu 12.04下編譯安裝nginx-1.9.3之後 tomcat叢集
一、tomcat安裝 1.安裝nginx 請檢視http://blog.csdn.net/liangzi4454/article/details/47023447 2. jdk安裝不在贅述,不會的同學,可以網上查詢教程; 3. tomcat下載
Ubuntu 12.04 下 用 Wine 安裝 RTX 2010
注意:最好 sudo su;su - 後安裝軟體等,本人對Linux使用者許可權管理不甚瞭解,但是如果沒賦管理員許可權安裝出錯了。我全程管理員許可權,但是第三步忘了出錯了,賦管理員許可權後第三步OK。
UBUNTU 12.04下傻瓜式簡單安裝arm-linux-gcc等gnu arm toolchain交叉編譯工具
歡迎轉載,轉載時請保留作者資訊,謝謝。 1. 驗證無誤的工具鏈安裝(能正常編譯linux,busybox等): 可以去這個地址下載工具鏈,是作者上傳的,要2分,當是辛苦分了,要免費的可以去min2440官網下載,地址我在下面也貼出來了。 CSDN下載連結:htt