當前位置:首頁 » 操作系統 » linuxmysql56安裝

linuxmysql56安裝

發布時間: 2022-05-05 06:15:30

『壹』 mysql5.6 64在linux上怎麼安裝

Linux下可以這樣安裝軟體: 1、如果是原代碼包的話,編譯安裝源代碼包 #mkdir temp //建立一個臨時目錄 #cp mysql-5.6.4-m7.tar.gz temp/ //將包拷到臨時目錄/temp中 #cd temp //切換到/temp目錄 #tar zxvf mysql-5.6.4-m7.tar.gz //解壓、歸檔一步到位,這時將生成一個新的目錄mysql-5.6.4-m7 #cd mysql-5.6.4-m7 //切換到mysql-5.6.4-m7目錄 #./configure //配置編譯環境 #make //開始編譯 #make install //安裝 至此,mysql-5.6.4-m7就裝好了。最後三步就是安裝源代碼包的標准操作。執行./configure後安裝程序會告訴你程序安裝後的所在目錄。 2、如果是rpm包的話,用rpm命令安裝.rpm包 RPM是Redhat Package Manager,是RedHat公司做的自動化安裝工具。 #cp mysql-5.6.4-m7.i386.rpm temp/ //將包拷貝到/temp目錄 #cd temp //切換到/temp目錄 #rpm -ivh mysql-5.6.4-m7.i386.rpm //這里是軟體包的全名 安裝時會顯示一個進度條,告訴你安裝過程。rpm安裝之前會先檢測系統的完整性,看是否缺少文件。如果缺少所需的文件,則拒絕安裝,並告知所缺的文件。 要刪除已裝的軟體,只需下面的命令 #rpm -e mysql-5.6.4-m7 //這里是軟體的名字 用RPM就這么簡單。

『貳』 linux上怎麼安裝mysql

1. 運行平台:CentOS 6.3 x86_64,基本等同於RHEL 6.3
2. 安裝方法:
安裝MySQL主要有兩種方法:一種是通過源碼自行編譯安裝,這種適合高級用戶定製MySQL的特性,這里不做說明;另一種是通過編譯過的二進制文件進行安裝。二進制文件安裝的方法又分為兩種:一種是不針對特定平台的通用安裝方法,使用的二進制文件是後綴為.tar.gz的壓縮文件;第二種是使用RPM或其他包進行安裝,這種安裝進程會自動完成系統的相關配置,所以比較方便。
3. 下載安裝包:
2. 下載文件(根據操作系統選擇相應的發布版本):
a. 通用安裝方法
mysql-5.5.29-linux2.6-x86_64.tar.gz
b. RPM安裝方法:
MySQL-server-5.5.29-2.el6.x86_64.rpm
MySQL-client-5.5.29-2.el6.x86_64.rpm
4. 通用安裝步驟
a. 檢查是否已安裝,grep的-i選項表示匹配時忽略大小寫
[root@localhost JavaEE]#rpm -qa|grep -i mysql
mysql-libs-5.1.61-4.el6.x86_64
*可見已經安裝了庫文件,應該先卸載,不然會出現覆蓋錯誤。注意卸:載時使用了--nodeps選項,忽略了依賴關系:
[root@localhost JavaEE]#rpm -e mysql-libs-5.1.61-4.el6.x86_64 --nodeps
b. 添加mysql組和mysql用戶,用於設置mysql安裝目錄文件所有者和所屬組。
[root@localhost JavaEE]#groupadd mysql
[root@localhost JavaEE]#useradd -r -g mysql mysql
*useradd -r參數表示mysql用戶是系統用戶,不可用於登錄系統。
c. 將二進制文件解壓到指定的安裝目錄,我們這里指定為/usr/local
[root@localhost ~]# cd/usr/local/
[root@localhost local]#tar zxvf /path/to/mysql-5.5.29-linux2.6-x86_64.tar.gz
*加壓後在/usr/local/生成了解壓後的文件夾mysql-5.5.29-linux2.6-x86_64,這名字太長,我們為它建立一個符號鏈接mysql,方便輸入。
[root@localhost local]#ln -s mysql-5.5.29-linux2.6-x86_64 mysql
d. /usr/local/mysql/下的目錄結構

Directory

Contents of Directory

bin

Client programs and the mysqld server

data

Log files, databases

docs

Manual in Info format

man

Unix manual pages

include

Include (header) files

lib

Libraries

scripts

mysql_install_db

share

Miscellaneous support files, including error messages, sample configuration files, SQL for database installation

sql-bench

Benchmarks

e. 進入mysql文件夾,也就是mysql所在的目錄,並更改所屬的組和用戶。
[root@localhost local]#cd mysql
[root@localhost mysql]#chown -R mysql .
[root@localhost mysql]#chgrp -R mysql .
f. 執行mysql_install_db腳本,對mysql中的data目錄進行初始化並創建一些系統表格。注意mysql服務進程mysqld運行時會訪問data目錄,所以必須由啟動mysqld進程的用戶(就是我們之前設置的mysql用戶)執行這個腳本,或者用root執行,但是加上參數--user=mysql。
[root@localhost mysql]scripts/mysql_install_db --user=mysql
*如果mysql的安裝目錄(解壓目錄)不是/usr/local/mysql,那麼還必須指定目錄參數,如
[root@localhost mysql]scripts/mysql_install_db --user=mysql \
--basedir=/opt/mysql/mysql \
--datadir=/opt/mysql/mysql/data
*將mysql/目錄下除了data/目錄的所有文件,改回root用戶所有,mysql用戶只需作為mysql/data/目錄下所有文件的所有者。
[root@localhost mysql]chown -R root .
[root@localhost mysql]chown -R mysql data
g. 復制配置文件
[root@localhost mysql] cp support-files/my-medium.cnf /etc/my.cnf
h. 將mysqld服務加入開機自啟動項。
*首先需要將scripts/mysql.server服務腳本復制到/etc/init.d/,並重命名為mysqld。
[root@localhostmysql] cp support-files/mysql.server /etc/init.d/mysqld
*通過chkconfig命令將mysqld服務加入到自啟動服務項中。
[root@localhost mysql]#chkconfig --add mysqld
*注意服務名稱mysqld就是我們將mysql.server復制到/etc/init.d/時重命名的名稱。
*查看是否添加成功
[root@localhost mysql]#chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
i. 重啟系統,mysqld就會自動啟動了。
*檢查是否啟動
[root@localhost mysql]#netstat -anp|grep mysqld
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2365/mysqld
unix 2 [ ACC ] STREAM LISTENING 14396 2365/mysqld /tmp/mysql.sock
*如果不想重新啟動,那可以直接手動啟動。
[root@localhost mysql]#service mysqld start
Starting MySQL.. SUCCESS!
j. 運行客戶端程序mysql,在mysql/bin目錄中,測試能否連接到mysqld。
[root@localhost mysql]#/usr/local/mysql/bin/mysql
Welcome to the MySQLmonitor. Commands end with ; or \g.
Your MySQL connection idis 2
Server version:5.5.29-log MySQL Community Server (GPL)

Copyright (c) 2000, 2012,Oracle and/or its affiliates. All rights reserved.
Oracle is a registeredtrademark of Oracle Corporation and/or its affiliates. Other names may betrademarks of their respective owners.
Type 'help;' or '\h' forhelp. Type '\c' to clear the current input statement.
mysql> quit
Bye
*此時會出現mysql>命令提示符,可以輸入sql語句,輸入quit或exit退出。為了避免每次都輸入mysql的全路徑/usr/local/mysql/bin/mysql,可將其加入環境變數中,在/etc/profile最後加入兩行命令:
MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin
這樣就可以在shell中直接輸入mysql命令來啟動客戶端程序了
[root@localhost mysql]#mysql
Welcome to the MySQLmonitor. Commands end with ; or \g.
Your MySQL connection idis 3
Server version:5.5.29-log MySQL Community Server (GPL)
Copyright (c) 2000, 2012,Oracle and/or its affiliates. All rights reserved.
Oracle is a registeredtrademark of Oracle Corporation and/or its
affiliates. Other namesmay be trademarks of their respective
owners.
Type 'help;' or '\h' forhelp. Type '\c' to clear the current input statement.
mysql>

5. RPM安裝步驟
a. 檢查是否已安裝,grep的-i選項表示匹配時忽略大小寫
[root@localhost JavaEE]#rpm -qa|grep -i mysql
mysql-libs-5.1.61-4.el6.x86_64
可見已經安裝了庫文件,應該先卸載,不然會出現覆蓋錯誤。注意卸載時使用了--nodeps選項,忽略了依賴關系:
[root@localhost JavaEE]#rpm -e mysql-libs-5.1.61-4.el6.x86_64 --nodeps
2. 安裝MySQL的伺服器端軟體,注意切換到root用戶:
[root@localhost JavaEE]#rpm -ivh MySQL-server-5.5.29-2.el6.x86_64.rpm
安裝完成後,安裝進程會在Linux中添加一個mysql組,以及屬於mysql組的用戶mysql。可通過id命令查看:
[root@localhost JavaEE]#id mysql
uid=496(mysql)gid=493(mysql) groups=493(mysql)
MySQL伺服器安裝之後雖然配置了相關文件,但並沒有自動啟動mysqld服務,需自行啟動:
[root@localhost JavaEE]#service mysql start
Starting MySQL.. SUCCESS!
可通過檢查埠是否開啟來查看MySQL是否正常啟動:
[root@localhost JavaEE]#netstat -anp|grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 34693/mysqld
c. 安裝MySQL的客戶端軟體:
[root@localhost JavaEE]#rpm -ivh MySQL-client-5.5.29-2.el6.x86_64.rpm
如果安裝成功應該可以運行mysql命令,注意必須是mysqld服務以及開啟:
[root@localhost JavaEE]#mysql
Welcome to the MySQLmonitor. Commands end with ; or \g.
Your MySQL connection idis 1
Server version: 5.5.29MySQL Community Server (GPL)
Copyright (c) 2000, 2012,Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademarkof Oracle Corporation and/or its affiliates. Other names may be trademarks oftheir respective owners.
Type 'help;' or '\h' forhelp. Type '\c' to clear the current input statement.
mysql>

『叄』 linux下mysql安裝

1. 安裝mysql
1) useradd -M -s /sbin/nologin mysql創建運行mysql資料庫的系統用戶、組
2) tar zxvf mysql-5.0.56.tar.gz -C /usr/src解壓並釋放源碼包
3) cd /usr/src/mysql-5.0.56/進入到解壓目錄
4) ./configure --prefix=/usr/local/mysql使用./configure命令配置編譯選項
5) make && make install編譯並安裝
6) cp support-files/my-medium.cnf /etc/my.cnf建立配置文件
7) /usr/local/mysql/bin/mysql_install_db --user=mysql利用mysql的身份去安裝mysql資料庫並初始化資料庫
8) chown -R root.mysql /usr/local/mysql/改變/usr/local/mysql/目錄的屬主和屬組
9) chown -R mysql /usr/local/mysql/var改變/usr/local/mysql/var目錄的屬主
10) echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf添加庫文件搜索路徑可以通過修改/etc/ld.so.conf文件實現
11) ldconfig刷新庫文件搜索路徑,是修改生效
2. mysql啟動控制
1) /usr/local/mysql/bin/mysqld_safe --user=mysql &在/usr/local/mysql/bin目錄中,存放著管理mysql伺服器的腳本和程序。其中腳本文件mysqld_safe可用來安全啟用mysql伺服器
2) netstat -tunpl | grep 3306查看3306的埠是否被監聽
3) cp support-files/mysql.server /etc/init.d/mysqld將mysqld服務的啟動腳本復制到/etc/init.d目錄下
4) chmod +x /etc/init.d/mysqld為目錄添加執行許可權
5) chkconfig --add mysqld使用—add選項的chkconfig命令將其設為系統自啟動服務
6) chkconfig mysqld on啟動mysqld的服務
7) export PATH=$PATH:/usr/local/mysql/bin/臨時設置mysql等命令和腳本的路徑
8) echo "PATH=$PATH:/usr/local/mysql/bin/" >> /etc/profile永久的添加搜索路徑

『肆』 如何安裝mysql-5.5.56-linux-glibc2.5-x86

大體有3種安裝方法:現在常用的方式就是網路安裝例如centos 用yum --install mysql 下載rpm包,然後rpm -ivh mysql名; 源碼安裝,下載tar包,解壓然後install安裝。 不知道你什麼linux系統,詳細的安裝方法你的網路一下,很多很多。

『伍』 在linux下怎麼安裝mysql資料庫

1. 安裝MySQL資料庫
先從MySQL官網下載MySQL,然後進入所下載的安裝文件所在目錄,運行如下命令進行安裝,其中MySQL-server-community-5.1.56-1.rhel5.i386.rpm為剛剛下載的MySQL資料庫伺服器的rpm包,然後使用/etc/rc.d/init.d/mysqlrestart命令重啟MySQL服務:
[root@localhost ~]# rpm -ivh MySQL-server-community-5.1.56-1.rhel5.i386.rpm
[root@localhost ~]# /etc/rc.d/init.d/mysql restart
Shutting down MySQL..[確定]
Starting MySQL..[確定]

2. 配置MySQL資料庫字元集
備註:配置MySQL資料庫字元集的目的是方便的使用資料庫,無需在每次連接的時候都要臨時設置資料庫字元集的,個人不建議採用這種方法,真正的工程項目都應該在連接資料庫時臨時設置資料庫字元集,如此才便於系統的移植,而且又不會影響資料庫伺服器中的其他資料庫的使用!
安裝完成之後,需要配置MySQL的字元集配置,首先需要查找MySQL的配置文件的位置,由於MySQL的配置文件名是以.cnf結尾的,因此可用如下命令進行查找:
[root@localhost ~]# find / -iname '*.cnf' -print
/usr/share/mysql/my-large.cnf
/usr/share/mysql/my-medium.cnf
/usr/share/mysql/my-innodb-heavy-4G.cnf
/usr/share/mysql/my-huge.cnf
/usr/share/mysql/my-small.cnf
/usr/share/doc/MySQL-server-community-5.1.56/my-large.cnf
/usr/share/doc/MySQL-server-community-5.1.56/my-medium.cnf
/usr/share/doc/MySQL-server-community-5.1.56/my-innodb-heavy-4G.cnf
/usr/share/doc/MySQL-server-community-5.1.56/my-huge.cnf
/usr/share/doc/MySQL-server-community-5.1.56/my-small.cnf
/etc/pki/tls/openssl.cnf

輸入完命令「find / -iname '*.cnf'-print」回車後,屏幕便顯示搜索到的MySQL配置文件,然後拷貝my-large.cnf、my-medium.cnf 、my-innodb-heavy-4G.cnf 、my-huge.cnf、my-small.cnf中任意的一個到/etc目錄下,並命名為my.cnf,其命令如下所示:
[root@localhost ~]# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
[root@localhost ~]# vi /etc/my.cnf

然後,使用vi編輯器修改/etc/my.cnf文件,在[client]下添加: 「default-character-set=gb2312」;在[mysqld]下添加:「default-character-set=gb2312」。如下所示:
# The following options will be passed to all MySQL clients
[client]
default-character-set=gb2312
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
default-character-set=gb2312
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K

按一下Esc鍵,輸入「:wq」後回車保存配置文件,輸入「/etc/rc.d/init.d/mysqlrestart」重啟MySQL服務,如下所示:
[root@localhost ~]# /etc/rc.d/init.d/mysql restart
Shutting down MySQL..[確定]
Starting MySQL..[確定]

最後,我們來驗證MySQL伺服器配置是否成功,首先登錄MySQL,輸入「mysql –uroot -p」回車,系統提示輸入密碼,登錄成功後進入MySQL命令模式,如下所示:
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.56-community-log MySQL Community Server (GPL)
Copyright (c) 2000, 2010, 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命令模式下分別輸入「show variables like'collation_%';」、「show variables like 'character_set_%';」回車後顯示字元集設置,如下所示:
mysql> show variables like 'collation_%';
+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | gb2312_chinese_ci |
| collation_database | gb2312_chinese_ci |
| collation_server | gb2312_chinese_ci |
+----------------------+-------------------+
3 rows in set (0.05 sec)
mysql> show variables like 'character_set_%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | gb2312 |
| character_set_connection | gb2312 |
| character_set_database | gb2312 |
| character_set_filesystem | binary |
| character_set_results | gb2312 |
| character_set_server | gb2312 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
mysql>

根據以上查詢結果可知我們設置的MySQL資料庫配置信息已經生效,至此完成MySQL的伺服器的安裝與配置。
3.關於MySQL資料庫的一些注意事項
3.1 遠程連接mysql速度慢
解決方法:
在MySQL伺服器的配置(/etc/my.cnf)中增加一個如下配置後速度飛快。

[mysqld]
skip-name-resolve

備註:這樣就能禁用DNS解析,連接速度會快很多。不過,這樣的話就不能在MySQL的授權表中使用主機名了而只能用ip格式。

3.2 重啟資料庫後,發現無需密碼(或者任何密碼)即可以連接
解決方法:
檢查你的MySQL配置文件(/etc/my.cnf)中是不是多了一條語句:「skip-grant-tables」,刪除(注釋)該語句,重新配置MySQL密碼,再次重啟MySQL服務即可!
備註:若使用skip-grant-tables系統將對任何用戶的訪問不做任何訪問控制,但可以用 mysqladmin flush-privileges或mysqladmin reload來開啟訪問控制;默認情況是show databases語句對所有用戶開放,如果mysql伺服器沒有開遠程帳戶,就在/etc/my.cnf裡面加上skip-grant-tables。

『陸』 linux下的mysql客戶端怎麼安裝

linux安裝mysql服務分兩種安裝方法:

①源碼安裝,優點是安裝包比較小,只有十多M,缺點是安裝依賴的庫多,安裝編譯時間長,安裝步驟復雜容易出錯;

②使用官方編譯好的二進制文件安裝,優點是安裝速度快,安裝步驟簡單,缺點是安裝包很大,300M左右。以下介紹linux使用官方編譯好的二進制包安裝mysql。

『柒』 如何在linux上安裝mysql 5.6

第一步:進入mysql官方網站
第二步:選擇MySQL Community Server(GPL)
第三步:進入下載頁面,會看到Mysql Community Server 5.6.17選擇自己的linux版本,我的是ubuntu14.04,選擇Linux-Generic,把頁面往下翻,選擇Linux-Generic(glibc 2.5)(x86,64-bit), Compressed TAR Archive下載
第四步:點擊下載之後會出現oracle的登陸界面,注冊用戶後登陸oracle賬號,即可免費下載mysql-5.6.17-linux-glibc2.5-x86_64.tar.gz

第五步:下載之後文件在/home/liubei/下載 目錄下,打開命令行,對文件夾進行解壓,給這么長的文件夾起個別名,找到mysql提供的官方安裝指導,具體代碼:

第五步代碼:
shell>cd /usr/local
shell>sudo tar zxvf /home/liubei/下載/mysql-5.6.17-linux-glibc2.5-x86_64.tar.gz
shell>sudo ln -s mysql-5.6.17-linux-glibc2.5-x86_64.tar.gz mysql
shell>cd mysql
shell>ls

第六步:通過上面的操作你就能看到mysql文件夾裡面的INSTALL-BINARY文件,用gedit將其打開,代碼如下
第六步代碼:
shell>gedit INSTALL-BINARY
第七步:這個文檔中會有如下圖所示的一段代碼,如下,接下來我分析文檔里的代碼,和我自己安裝過程中的一些問題,和我的安裝代碼
第八步:
文檔安裝代碼:
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysqlshell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
第九步:
文檔安裝代碼中每一行的意思:
shell> groupadd mysql //在/etc/group文件中添加mysql的記錄
shell> useradd -r -g mysql mysql
shell> cd /usr/local //打開/usr/local目錄
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz // /path/to/mysql-VERSION-OS.tar.gz指下載的文件的具體路徑我的是 /home/liubei/下載/mysql-5.6.17-linux-glibc2.5-x86_64.tar.gz
//這個步驟解壓下載的mysql壓縮文件到/usr/local文件夾下
shell> ln -s full-path-to-mysql-VERSION-OS mysql //為很長的文件夾取個別名並創建鏈接
shell> cd mysql //打開mysql文件夾
shell> chown -R mysql . //注意後面有個點,意思是把文件夾的own許可權賦予mysql用戶shell> chgrp -R mysql . //後面也有點,意思是把文件夾的grp許可權賦予mysql用戶,文件夾的許可權可以通過
shell>ls -la查看
shell> scripts/mysql_install_db --user=mysql //通過mysql用戶安裝mysql
shell> chown -R root . //把文件夾的own許可權賦予root
shell> chown -R mysql data //把data文件夾的own許可權賦予mysql
shell> bin/mysqld_safe --user=mysql &//啟動mysql
shell> cp support-files/mysql.server /etc/init.d/mysql.server //復制mysql.server文件到/etc/init.d目錄下

第十步:因為我是新裝的ubuntu系統,所以在安裝過程中遇到很多問題,按教程中的不能完全成功,接下來貼出我自己的安裝命令:
第十步安裝命令:
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> sudo scripts/mysql_install_db --user=mysql
這一步之後sudo gedit my.cnf
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql --datadir=/usr/local/mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
第十一步:
各行中的命令的意思:
shell> groupadd mysqlshell> useradd -r -g mysql mysqlshell> cd /usr/local
//實際在做解壓到/usr/local目錄下是需要管理員許可權的如下:
shell>sudo tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> sudo ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
//給文件夾賦予許可權的命令都需要管理員許可權shell> sudo chown -R mysql .
shell> sudo chgrp -R mysql .
shell> sudo scripts/mysql_install_db --user=mysql
//新系統在執行上面這行代碼時會報錯,按照報錯中的提示安裝所需插件即可
//這一步之後sudo gedit my.cnf ,修改mysql的啟動信息,如下圖所示
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql --datadir=/usr/local/mysql/data &
//上面這步總是報錯後在後面加上 --datadir參數後成功啟動mysql
//這一步進行後即可成功啟動mysql,輸入
shell>mysql
如果出現如下圖所示,即啟動mysql成功
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

第十二步:
另外:關閉mysql的命令
shell>sudo service mysqld stop
然後啟動mysql的命令
shell> sudo service mysqld start

『捌』 如何在linux下安裝mysql

1、到mysql官網下載mysql編譯好的二進制安裝包,在下載頁面SelectPlatform:選項選擇linux-generic,然後把頁面拉到底部,

64位系統下載Linux-Generic(glibc2.5)(x86,64-bit),32位系統下載Linux-Generic(glibc2.5)(x86,32-bit)

2、解壓32位安裝包:

進入安裝包所在目錄,執行命令:tarmysql-5.6.17-linux-glibc2.5-i686.tar.gz

3、復制解壓後的mysql目錄到系統的本地軟體目錄:

執行命令:cpmysql-5.6.17-linux-glibc2.5-i686/usr/local/mysql-r

4、添加系統mysql組和mysql用戶:

執行命令:groupaddmysql和useradd-r-gmysqlmysql

5、安裝資料庫:

進入安裝mysql軟體目錄:執行命令cd/usr/local/mysql

修改當前目錄擁有者為mysql用戶:執行命令?chown-Rmysql:mysql./

安裝資料庫:執行命令?./scripts/mysql_install_db--user=mysql

修改當前目錄擁有者為root用戶:執行命令?chown-Rroot:root./

修改當前data目錄擁有者為mysql用戶:執行命令?chown-Rmysql:mysqldata

到此資料庫安裝完畢

6、啟動mysql服務和添加開機啟動mysql服務:

添加開機啟動:執行命令cpsupport-files/mysql.server/etc/init.d/mysql,把啟動腳本放到開機初始化目錄

啟動mysql服務:執行命令servicemysqlstart

執行命令:ps-ef|grepmysql看到mysql服務說明啟動成功

7、修改mysql的root用戶密碼,root初始密碼為空的:

執行命令:./bin/mysqladmin-urootpassword'密碼'

8、把mysql客戶端放到默認路徑:

ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql

注意:建議使用軟鏈過去,不要直接包文件復制,便於系統安裝多個版本的mysql

『玖』 在linux中怎麼安裝mysql

到mysql官網下載mysql編譯好的二進制安裝包

解壓32位安裝包:
進入安裝包所在目錄,執行命令:tar mysql-5.6.17-linux-glibc2.5-i686.tar.gz

復制解壓後的mysql目錄到系統的本地軟體目錄:
執行命令:cp mysql-5.6.17-linux-glibc2.5-i686 /usr/local/mysql -r
注意:目錄結尾不要加/

添加系統mysql組和mysql用戶:
執行命令:groupadd mysql和useradd -r -g mysql mysql

安裝資料庫:
進入安裝mysql軟體目錄:執行命令 cd /usr/local/mysql
修改當前目錄擁有者為mysql用戶:執行命令 chown -R mysql:mysql ./
安裝資料庫:執行命令 ./scripts/mysql_install_db --user=mysql
修改當前目錄擁有者為root用戶:執行命令 chown -R root:root ./
修改當前data目錄擁有者為mysql用戶:執行命令 chown -R mysql:mysql data
到此資料庫安裝完畢

熱點內容
如何刪除手機中的游戲緩存 發布:2024-10-07 02:11:28 瀏覽:873
解鎖資料庫用戶 發布:2024-10-07 01:55:54 瀏覽:826
關系資料庫的關鍵字是指 發布:2024-10-07 01:55:54 瀏覽:517
java資料庫date 發布:2024-10-07 01:55:21 瀏覽:458
安卓12如何開通運用許可權 發布:2024-10-07 01:29:54 瀏覽:134
電腦顯示已連接圖形伺服器 發布:2024-10-07 01:24:38 瀏覽:797
如何恢復手機伺服器的時速 發布:2024-10-07 01:22:30 瀏覽:749
c語言六套 發布:2024-10-07 01:22:26 瀏覽:383
安卓手機系統文件存在哪裡 發布:2024-10-07 01:21:30 瀏覽:898
編譯原理文字題 發布:2024-10-07 00:53:58 瀏覽:332