日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

liunx上mysql源码安装mysql,搞定linux上MySQL编程(一):linux上源码安装MySQL

發(fā)布時間:2023/11/28 生活经验 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 liunx上mysql源码安装mysql,搞定linux上MySQL编程(一):linux上源码安装MySQL 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

【版權(quán)聲明:尊重原創(chuàng),轉(zhuǎn)載請保留出處:blog.csdn.net/shallnet,文章僅供學習交流,請勿用于商業(yè)用途】

1. 首先下載源碼包:

ftp://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.1/mysql-5.1.72.tar.gz

2. 使用如下命令檢查系統(tǒng)中是否已安裝mysql:

rpm -qa | grep mysql

3.沒有安裝則解壓安裝包然后進入該目錄:

cd mysql

分別依次執(zhí)行如下操作:

./configure --prefix=/usr/local/mysql --with-charset=gbk

make

make install

4.添加MySQL配置文件

如果你想要設(shè)置一個選項文件,使用support-files目錄中的一個作為模板。在這個目錄中有4個模板文件,是根據(jù)不同機器的內(nèi)存定制的。

#cp support-files/my-medium.cnf /etc/my.cnf

5.設(shè)置開機自動啟動

#cp support-files/mysql.server /etc/rc.d/init.d/mysqld

#chmod 755 /etc/init.d/mysqld

#chkconfig –-add mysqld

#chkconfig –-level 345 mysqld on

6.創(chuàng)建mysql權(quán)限表:

cd /usr/local/mysql

scripts/mysql_install_db --user=mysql

7.最后將安裝目錄的擁有者和所屬組分別變更為root和mysql, 命令為:

chown -R root

chgrp -R mysql

8.測試成功否?

第一次運行會彈出如下信息,說明安裝成功:

#/etc/rc.d/init.d/mysqld start

Initializing MySQL database:? Installing MySQL system tables...

OK

Filling help tables...

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:

/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:

/usr/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 /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

[? OK? ]

Starting mysqld:?????????????????????????????????????????? [? OK? ]

9.查看3306端口是否啟動:

# netstat -altnp

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 6946/mysqld

tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1892/rpcbind

tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2726/dnsmasq

10.為了安全,需要修改密碼,默認為空:

mysqladmin -u root password shallnet

至此,可以在命令行上面使用新的密碼登錄mysql了。

總結(jié)

以上是生活随笔為你收集整理的liunx上mysql源码安装mysql,搞定linux上MySQL编程(一):linux上源码安装MySQL的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。