ubuntu14安装mysql5.6_ubuntu14.04安装mysql5.6.37
摘抄這篇文檔是為了記錄自己的日常學習情況,方便以后查看。后邊注明了來源,如有不對的地方,希望大家指正,謝謝!
首先從mysql官網上下載所需的離線包,我現在的版本是(mysql-5.6.37-linux-glibc2.12-x86_64)。
Select Operating System:? linux-generic,選擇(mysql-5.6.37-linux-glibc2.12-x86_64)下載。
下載完之后,將tar包拷貝到/usr/loacl目錄下解壓縮:
tar -xzvf? mysql-5.6.37-linux-glibc2.12-x86_64
重命名為mysql:
mv ?mysql-5.6.37-linux-glibc2.12-x86_64 mysql
在安裝之前先升級源文件和安裝一個依賴包,mysql運行的時候會用到這個依賴包,否則運行不了:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libaio-dev
1依賴包安裝完之后就該安裝mysql了,在/usr/local/mysql目錄下運行命令(后同),:(注意輸出的文字,里邊有修改root密碼和啟動mysql的命令)
./scripts/mysql_install_db --user=root
Installing MySQL system tables...
151015 14:11:15 [Note] ./bin/mysqld (mysqld 5.5.45) starting as process 10902 ...
OK
Filling help tables...
151015 14:11:15 [Note] ./bin/mysqld (mysqld 5.5.45) starting as process 10908 ...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h qiuxiao-ubuntu password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. ?This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
啟動mysql,指定root用戶:
./bin/mysqld_safe --user=root &
設置root用戶密碼
./bin/mysqladmin -u root password 'linxiaohui'
##
重啟mysql:
./bin/mysqladmin -uroot -p密碼 shutdown(注意,u,p后沒有空格)
./bin/mysqld_safe --user=root &eg:
重啟mysql:
./bin/mysqladmin -uroot -plinxiaohuishutdown(注意,u,p后沒有空格)
./bin/mysqld_safe --user=root &
eg1:? ? root@suepc:/usr/local/mysql/mysql-5.6.37-linux-glibc2.12-x86_64# ./bin/mysqld_safe --user=root &
eg2:? ?root@suepc:/usr/local/mysql/mysql-5.6.37-linux-glibc2.12-x86_64# ./bin/mysql -u root -p
運行eg1和eg2兩條命令,成功進入mysql.
設置允許root遠程連接:1)本機登陸mysql:
./bin/mysql -u root -p
2)從所有主機:
mysql> grant all privileges on *.* to root@"%" identified by "root用戶的密碼" with grant option;
3)從指定主機:
mysql> grant all privileges on *.* to root@"192.168.11.205" identified by "root用戶的密碼" with grant option; flush privileges;
設置字符集:查詢字符集:
mysql> show variables like 'character%';
1
mysql> SET character_set_database = utf8;
mysql> SET character_set_server = utf8;
1
2
重啟,使字符集生效
設置開機啟動可以通過support-files下的mysql.server啟動停止mysql,命令如下:啟動mysql:./support-files/mysql.server start –user=root停止mysql:./support-files/mysql.server stop
1)mysql啟動默認使用的是/etc/my.cnf配置文件,所以拷貝一份配置文件到/etc/下:
cp ./support-files/my-medium.cnf /etc/my.cnf
1
2)拷貝mysql.server文件到/etc/init.d/目錄下:
cp ./support-files/mysql.server /etc/init.d/mysql.server
1
3)指定啟動時所使用的用戶,修改my.cnf配置文件,在[mysqld]下加一行user=root:
vim /etc/my.cnf
1
4)設置開機啟動:
update-rc.d -f mysql.server defaults
1
至此,mysql安裝完畢,重啟Ubuntu,驗證一下mysql是否已經隨機啟動
Navicat連接mysql
由圖可知,連接成功!
參考出處:http://blog.csdn.net/qiuxiao630320/article/details/49150585
總結
以上是生活随笔為你收集整理的ubuntu14安装mysql5.6_ubuntu14.04安装mysql5.6.37的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 协作与协同有什么区别_OA软件, BPM
- 下一篇: jmeter中控制器其中一个访问不到_J