本篇內(nèi)容主要講解“Linux服務(wù)器如何安裝mysql”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“Linux服務(wù)器如何安裝mysql”吧!

創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:
成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的
靖宇網(wǎng)站設(shè)計(jì)、移動媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
安裝mysql
1、檢測是否已安裝mysql
[root@localhost bin]# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.i686
[root@localhost bin]
|
2、安裝mysql和mysql-server
[root@localhost bin]# yum install -y mysql
[root@localhost bin]# yum install -y mysql-server
|
3、啟動mysql,注意這里的服務(wù)名字是“mysqld”
[root@localhost bin]# service mysqld start
shell-init: error retrieving current directory: getcwd: cannot access parent directories: 沒有那個文件或目錄
chdir: error retrieving current directory: getcwd: cannot access parent directories: 沒有那個文件或目錄
初始化 MySQL 數(shù)據(jù)庫: Installing MySQL system tables...
OK
Filling help tables...
OK [ 確定 ]
正在啟動 mysqld : [ 確定 ]
[root@localhost bin]#
|
4、配置MySQL開機(jī)啟動
[root@localhost bin]# chkconfig mysqld on
[root@localhost bin]# chkconfig --list mysqld
mysqld 0: 關(guān)閉 1: 關(guān)閉 2: 啟用 3: 啟用 4: 啟用 5: 啟用 6: 關(guān)閉
[root@localhost bin]#
|
5、設(shè)置root用戶密碼 ,設(shè)置密碼的命令是“mysqladmin -u
用戶名
password
密碼
”
[root@localhost bin]# mysqladmin -u root password 543092 // 密碼是 543092
|
6、修改密碼,命令是“mysqladmin -u
用戶名
-p password
新密碼
”
[root@localhost bin]# mysqladmin -u root -p password 123456 // 新密碼 123456
Enter password: // 這里要求輸入舊密碼
[root@localhost bin]#
|
7、mysql配置文件“/etc/my.cnf”
[root@localhost bin]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql // 數(shù)據(jù)庫文件目錄
socket=/var/lib/mysql/mysql.sock //socket 文件
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log // 日志文件
pid-file=/var/run/mysqld/mysqld.pid // 進(jìn)程 pid 文件
|
8、修改端口
1)mysql默認(rèn)的端口是3306,可以使用netstat來查看
[root@localhost bin]# netstat -tunlp | grep mysqld
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 4339/mysqld
|
2)端口在配置文件中修改,打開配置文件,在后面追加一句話”port=xxx”
[root@localhost bin]# gedit /etc/my.cnf
port=3307
|
3)重啟myslqd服務(wù),查看端口
[root@localhost bin]# service mysqld restart
shell-init: error retrieving current directory: getcwd: cannot access parent directories: 沒有那個文件或目錄
chdir: error retrieving current directory: getcwd: cannot access parent directories: 沒有那個文件或目錄
^[[A 停止 mysqld : [ 確定 ]
正在啟動 mysqld : [ 確定 ]
[root@localhost bin]# netstat -tunlp | grep mysqld
tcp 0 0 0.0.0.0:3307 0.0.0.0:* LISTEN 4604/mysqld
|
到此,相信大家對“Linux服務(wù)器如何安裝mysql”有了更深的了解,不妨來實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
當(dāng)前題目:Linux服務(wù)器如何安裝mysql-創(chuàng)新互聯(lián)
本文地址:http://jinyejixie.com/article20/csppjo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App設(shè)計(jì)、關(guān)鍵詞優(yōu)化、網(wǎng)站排名、網(wǎng)站策劃、Google、網(wǎng)站設(shè)計(jì)
廣告
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源:
創(chuàng)新互聯(lián)