搜尋
首頁資料庫mysql教程linux 下 MySQL源码包的安装_MySQL

mysql安装

    linux 下 MySQL源码包的安装
    实验环境 VMware 6.5.2 +redhatEnterprise 5 AS
    实验目的 初步涉及源码包的安装,以简单实现其功能为目的,不对原理进行深层讨论
    内核版本:

linux 下 MySQL源码包的安装_MySQL


    今天尝试安装MySQL的源码包 mysql-4.0.27.tar.gz
    下载源码包 copy 到linux
    [root@localhost ~]# cd /tmp
    [root@localhost tmp]# ls
    gconfd-laowu scim-helper-manager-socket-root
    gconfd-root scim-panel-socket:0-laowu
    keyring-8zb2FJ scim-panel-socket:0-root
    linuxqq_v1.0.2-beta1_i386 scim-socket-frontend-root
    linuxqq_v1.0.2-beta1_i386.tar.gz sealert.log
    mapping-laowu ssh-lgCAZY2854
    mapping-root virtual-root.Kez8K1
    mysql-4.0.27.tar.gz VMwareDnD
    orbit-root vmware-root
    scim-bridge-0.3.0.lockfile-0@localhost:0.0 VMwareTools-7.8.4-126130.tar.gz
    scim-bridge-0.3.0.socket-0@localhost:0.0 vmware-tools-distrib
    [root@localhost tmp]#
    [root@localhost tmp]# tar zxvf mysql-4.0.27.tar.gz
    把源码包mysql-4.0.27.tar.gz 解压到当前目录

linux 下 MySQL源码包的安装_MySQL


    [root@localhost tmp]# cd mysql-4.0.27
    进入mysql-4.0.27目录
    [root@localhost mysql-4.0.27]# ls
    acconfig.h configure.in INSTALL-SOURCE missing regex
    acinclude.m4 COPYING isam mkinstalldirs scripts
    aclocal.m4 dbug libmysql myisam sql
    bdb depcomp libmysqld myisammrg sql-bench
    BUILD Docs libmysql_r mysql-test strings
    ChangeLog EXCEPTIONS-CLIENT ltconfig mysys support-files
    client extra ltmain.sh netware tests
    config.guess heap Makefile.am os2 tools
    config.h.in include Makefile.in pstack vio
    config.sub innobase man readline
    configure install-sh merge README
    [root@localhost mysql-4.0.27]#
    INSTALL-SOURCE这里面有你需要的安装命令
    添加mysql用户组
    [root@localhost mysql-4.0.27]# groupadd mysql
    You have mail in /var/spool/mail/root
    添加mysql用户 并指定到mysql组中
    [root@localhost mysql-4.0.27]# useradd -g mysql mysql
    [root@localhost mysql-4.0.27]#
    [root@localhost mysql-4.0.27]# echo "/* Linuxthreads */" >> /usr/include/pthread.h
    你也可以直接运行下面这条命令直接执行编译准备,如果有错误,试试上面得阴影部分命令
    [root@localhost mysql-4.0.27]# ./configure --prefix=/usr/local/mysql
    编译前的准备,指定安装目录到/usr/local/mysql
    试计算机性能不同,时间略有差别

linux 下 MySQL源码包的安装_MySQL


    [root@localhost mysql-4.0.27]# make
    编译过程

linux 下 MySQL源码包的安装_MySQL


    [root@localhost mysql-4.0.27]# make install
    编译安装 稍等
   

linux 下 MySQL源码包的安装_MySQL


    [root@localhost mysql-4.0.27]# cp support-files/my-medium.cnf /etc/my.cnf
    复制mysql配置文件
    [root@localhost mysql-4.0.27]# 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
    090501 15:30:45 /usr/local/mysql/libexec/mysqld: Shutdown Complete
    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/local/mysql/bin/mysqladmin -u root password 'new-password'
    /usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
    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 'sql-bench' directory:
    cd sql-bench ; perl run-all-tests
    Please report any problems with the /usr/local/mysql/bin/mysqlbug script!
    The latest information about MySQL is available on the web at
    [url]http://www.mysql.com[/url]
    Support MySQL by buying support/licenses at [url]http://shop.mysql.com[/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服务 &为后台启动
    [1] 17776
    [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 1 to server version: 4.0.27-log
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    mysql>
    mysql> show databases ;
    基本的查看数据库命令
    +----------+
    | Database |
    +----------+
    | mysql |
    | test |
    +----------+
    2 rows in set (0.00 sec)
    mysql>
    mysql> ?
    查询命令
    For the complete MySQL Manual online visit:
    [url]http://www.mysql.com/documentation[/url]
    For info on technical support from MySQL developers visit:
    [url]http://www.mysql.com/support[/url]
    For info on MySQL books, utilities, consultants, etc. visit:
    [url]http://www.mysql.com/portal[/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) Don't 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: 2 (Can be used with mysqladmin kill)
    mysql> quit
    Bye
    [root@localhost mysql]#
    退出数据库

 

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
將用戶添加到MySQL:完整的教程將用戶添加到MySQL:完整的教程May 12, 2025 am 12:14 AM

掌握添加MySQL用戶的方法對於數據庫管理員和開發者至關重要,因為它確保數據庫的安全性和訪問控制。 1)使用CREATEUSER命令創建新用戶,2)通過GRANT命令分配權限,3)使用FLUSHPRIVILEGES確保權限生效,4)定期審計和清理用戶賬戶以維護性能和安全。

掌握mySQL字符串數據類型:varchar vs.文本與char掌握mySQL字符串數據類型:varchar vs.文本與charMay 12, 2025 am 12:12 AM

chosecharforfixed-lengthdata,varcharforvariable-lengthdata,andtextforlargetextfield.1)chariseffity forconsistent-lengthdatalikecodes.2)varcharsuitsvariable-lengthdatalikenames,ballancingflexibilitibility andperformance.3)

MySQL:字符串數據類型和索引:最佳實踐MySQL:字符串數據類型和索引:最佳實踐May 12, 2025 am 12:11 AM

在MySQL中處理字符串數據類型和索引的最佳實踐包括:1)選擇合適的字符串類型,如CHAR用於固定長度,VARCHAR用於可變長度,TEXT用於大文本;2)謹慎索引,避免過度索引,針對常用查詢創建索引;3)使用前綴索引和全文索引優化長字符串搜索;4)定期監控和優化索引,保持索引小巧高效。通過這些方法,可以在讀取和寫入性能之間取得平衡,提升數據庫效率。

mysql:如何遠程添加用戶mysql:如何遠程添加用戶May 12, 2025 am 12:10 AM

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

MySQL字符串數據類型的最終指南:有效的數據存儲MySQL字符串數據類型的最終指南:有效的數據存儲May 12, 2025 am 12:05 AM

tostorestringsefliceflicyInmySql,ChooSetherightDataTypeBasedyOrneOrneEds:1)USEcharforFixed-LengthStstringStringStringSlikeCountryCodes.2)UseVarcharforvariable-lengtthslikenames.3)USETEXTCONTENT.3)

mysql blob vs.文本:為大對象選擇正確的數據類型mysql blob vs.文本:為大對象選擇正確的數據類型May 11, 2025 am 12:13 AM

選擇MySQL的BLOB和TEXT數據類型時,BLOB適合存儲二進制數據,TEXT適合存儲文本數據。 1)BLOB適用於圖片、音頻等二進制數據,2)TEXT適用於文章、評論等文本數據,選擇時需考慮數據性質和性能優化。

MySQL:我應該將root用戶用於產品嗎?MySQL:我應該將root用戶用於產品嗎?May 11, 2025 am 12:11 AM

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQL字符串數據類型說明了:選擇適合您數據的合適類型MySQL字符串數據類型說明了:選擇適合您數據的合適類型May 11, 2025 am 12:10 AM

mySqlStringDatatAtatPessHouldBechoseBasedondatActarActeristicsAndusecases:1)USEcharforFixed lengthStstringStringStringSlikeCountryCodes.2)usevarcharforvariable-lengtthslikeLikenames.3)usebarnionororvarinyorvarinyorvarybinarydatalgebenedaTalgeextocrabextrapon.4)

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

強大的PHP整合開發環境

EditPlus 中文破解版

EditPlus 中文破解版

體積小,語法高亮,不支援程式碼提示功能

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。

MantisBT

MantisBT

Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。