熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> MySQL >> 正文

linux 下 MySQL源碼包的安裝

2022-06-13   來源: MySQL 

  linux 下 MySQL源碼包的安裝
    實驗環境 VMware +redhatEnterprise AS
    實驗目的 初步涉及源碼包的安裝以簡單實現其功能為目的不對原理進行深層討論
    內核版本

  

  今天嘗試安裝MySQL的源碼包 mysqltargz
    下載源碼包 copy 到linux
    [root@localhost ~]# cd /tmp
    [root@localhost tmp]# ls
    gconfdlaowu scimhelpermanagersocketroot
    gconfdroot scimpanelsocket:laowu
    keyringzbFJ scimpanelsocket:root
    linuxqq_vbeta_i scimsocketfrontendroot
    linuxqq_vbeta_itargz sealertlog
    mappinglaowu sshlgCAZY
    mappingroot virtualrootKezK
    mysqltargz VMwareDnD
    orbitroot vmwareroot
    scimbridgelockfile@localhost: VMwareToolstargz
    scimbridgesocket@localhost: vmwaretoolsdistrib
    [root@localhost tmp]#
    [root@localhost tmp]# tar zxvf mysqltargz
    把源碼包mysqltargz 解壓到當前目錄

  

  [root@localhost tmp]# cd mysql
    進入mysql目錄
    [root@localhost mysql]# ls
    acconfigh configurein INSTALLSOURCE missing regex
    acincludem COPYING isam mkinstalldirs scripts
    aclocalm dbug libmysql myisam sql
    bdb depcomp libmysqld myisammrg sqlbench
    BUILD Docs libmysql_r mysqltest strings
    ChangeLog EXCEPTIONSCLIENT ltconfig mysys supportfiles
    client extra ltmainsh netware tests
    configguess heap Makefileam os tools
    confighin include Makefilein pstack vio
    configsub innobase man readline
    configure installsh merge README
    [root@localhost mysql]#
    INSTALLSOURCE這裡面有你需要的安裝命令
    添加mysql用戶組
    [root@localhost mysql]# groupadd mysql
    You have mail in /var/spool/mail/root
    添加mysql用戶 並指定到mysql組中
    [root@localhost mysql]# useradd g mysql mysql
    [root@localhost mysql]#
    [root@localhost mysql]# echo /* Linuxthreads */ >> /usr/include/pthreadh
    你也可以直接運行下面這條命令直接執行編譯准備如果有錯誤試試上面得陰影部分命令
    [root@localhost mysql]# /configure prefix=/usr/local/mysql
    編譯前的准備指定安裝目錄到/usr/local/mysql
    試計算機性能不同時間略有差別

  

  [root@localhost mysql]# make
    編譯過程

  

  [root@localhost mysql]# make install
    編譯安裝 稍等
   

  

  [root@localhost mysql]# cp supportfiles/f /etc/f
    復制mysql配置文件
    [root@localhost mysql]# cd /usr/local/mysql
    進入安裝目錄
    [root@localhost mysql]# bin/mysql_install_db user=mysql
    使用mysql用戶 初始化數據庫
    Preparing db table
    Preparing host table
    Preparing user table
    Preparing func table
    Preparing tables_priv table
    Preparing columns_priv table
    Installing all prepared tables
    :: /usr/local/mysql/libexec/mysqld: Shutdown Complete
    To start mysqld at boot time you have to copy supportfiles/mysqlserver
    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/local/mysql/bin/mysqladmin u root password newpassword
    /usr/local/mysql/bin/mysqladmin u root h localhostlocaldomain password newpassword
    See the manual for more instructions
    You can start the MySQL daemon with:
    cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
    You can test the MySQL daemon with the benchmarks in the sqlbench directory:
    cd sqlbench ; perl runalltests
    Please report any problems with the /usr/local/mysql/bin/mysqlbug script!
    The latest information about MySQL is available on the web at
    [url][/url]
    Support MySQL by buying support/licenses at [url][/url]
    [root@localhost mysql]#
    [root@localhost mysql]# chown R root
    改變當前目錄的所有屬主為root
    R 為遞歸(即其下所有的子文件的屬主也隨之改為root)
    [root@localhost mysql]# chown R mysql var
    改變var的屬主為mysql
    [root@localhost mysql]# chgrp R mysql
    改變當前目錄的屬組為mysql
    [root@localhost mysql]#
    [root@localhost mysql]# bin/mysqld_safe user=mysql &
    後台啟動mysql服務 &為後台啟動
    []
    [root@localhost mysql]# Starting mysqld daemon with databases from /usr/local/mysql/var
    [root@localhost mysql]#
    [root@localhost mysql]# /usr/local/mysql/bin/mysql
    登陸到mysql數據庫
    Welcome to the MySQL monitor Commands end with ; or \g
    Your MySQL connection id is to server version: log
    Type help; or \h for help Type \c to clear the buffer
    mysql>
    mysql> show databases ;
    基本的查看數據庫命令
    ++
    | Database |
    ++
    | mysql |
    | test |
    ++
    rows in set ( sec)
    mysql>
    mysql> ?
    查詢命令
    For the complete MySQL Manual online visit:
    [url][/url]
    For info on technical support from MySQL developers visit:
    [url][/url]
    For info on MySQL books utilities consultants etc visit:
    [url][/url]
    List of all MySQL commands:
    (Commands must appear first on line and end with ;)
    help (\h) Display this help
    ? (\?) Synonym for `help
    clear (\c) Clear command
    connect (\r) Reconnect to the server Optional arguments are db and host
    edit (\e) Edit command with $EDITOR
    ego (\G) Send command to mysql server display result vertically
    exit (\q) Exit mysql Same as quit
    go (\g) Send command to mysql server
    nopager (\n) Disable pager print to stdout
    notee (\t) Dont write into outfile
    pager (\P) Set PAGER [to_pager] Print the query results via PAGER
    print (\p) Print current command
    prompt (\R) Change your mysql prompt
    quit (\q) Quit mysql
    rehash (\#) Rebuild completion hash
    source (\) Execute a SQL script file Takes a file name as an argument
    status (\s) Get status information from the server
    system (\!) Execute a system shell command
    tee (\T) Set outfile [to_outfile] Append everything into given outfile
    use (\u) Use another database Takes database name as argument
    Connection id: (Can be used with mysqladmin kill)
    mysql> quit
    Bye
    [root@localhost mysql]#
    退出數據庫


From:http://tw.wingwit.com/Article/program/MySQL/201311/29357.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.