歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux服務器 >> Mysql linux安裝日志

Mysql linux安裝日志

日期:2017/3/2 16:53:56   编辑:Linux服務器

1.Add a login user and group for `mysqld' to run as:為‘mysqld’增添一個登陸用戶和組
shell> groupadd mysql
shell> useradd -g mysql mysql

2.解壓
shell> gunzip < mysql-5.0.15.tar.gz | tar -xvf -
shell> cd mysql-5.0.15

3.Configure the release and compile everything:配置和編譯給configure分配可執行文件
shell> chmod +x configure
改變字符集為 GBK [默認字符集為ISO-8859-1(Latin1)]
shell> ./configure --prefix=/usr/local/mysql --with-charset=gbk
shell> make
(字符集還有big5、cp1251、cp1257、czech、danish、dec8、dos、euc_kr、gb2312 gbk、german1、hebrew、 hp8、hungarian、koi8_ru、koi8_ukr、latin1、latin2、sjis、swe7、tis620、ujis、usa7、win1251或win1251ukr)

4.安裝所有東西
shell> make install

5.如果你想安裝選項文件,使用當前存在的‘support-files’ 文件夾下的作為模板,例如:
shell> cp support-files/my-medium.cnf /etc/my.cnf

6.如果想mysqld每次開機自動啟動的話。cp -r support-files/mysql.server /etc/init.d/就行了
shell> cp -r support-files/mysql.server /etc/init.d/mysql
shell> cd /etc/rc.d/init.d
shell> chmod +x mysql
shell> /sbin/chkconfig --del mysql
shell> /sbin/chkconfig --add mysql

7.進入安裝目錄
shell> cd /usr/local/mysql

8.如果你以前沒有安裝過MySQL,你必須創建一個MySQL准許的表
shell> bin/mysql_install_db --user=mysql

9.將程序的所有權限給‘root’ ,並且把數據目錄的所有權給可以運行‘mysqld’的用戶。假設MySQL的安裝目錄是(‘/usr/local/mysql’),命令如下所示:
把文件擁有權給‘root’
shell> chown -R root .
把數據目錄擁護權給‘mysql’用戶
shell> chown -R mysql var
把組的權限給'mysql'組
shell> chgrp -R mysql .

10.萬事具備後,你就可以按照下面的命令測試並運行你的MySQL了:
shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
shell> service mysql start

11.在一切正常後,要做的第一件事情是更改管理員的密碼。你可以運行mysqladmin (請注意,此命令不一定在你的path中,所以最好是轉到此命令的目錄中直接執行):
shell> cd bin
shell> ./mysqladmin -u root password *********

12.運行其他用戶訪問本機:
shell> ./mysql -u root -p mysql
--------------------這裡輸入你剛才修改的管理員密碼
mysql> update user set host='' where host='localhost' and user='root';
mysql> exit
Bye

13.修改mysql數據庫端口號
shell> vi /etc/my.cnf
--------------------修改裡面的 port=**** 為你需要的端口號

14.重啟應用
shell> service mysql restart

Copyright © Linux教程網 All Rights Reserved