搜索
首页数据库mysql教程mysql 装配 (转)

mysql 装配 (转)

Jun 07, 2016 pm 04:23 PM
makemysql安装编译器默认

mysql 安装 (转) 1.安装make编译器(默认系统自带) 下载地址:http://www.gnu.org/software/make/ ? [c-sharp] ?view plaincopy? tar?zxvf?make-3.82.tar.gz?? cd?make-3.82?? ./configure?? make?? make?install?? [c-sharp] ?view plaincopy? tar?zxvf?mak

mysql 安装 (转)

1.安装make编译器(默认系统自带)

下载地址:http://www.gnu.org/software/make/

?

[c-sharp]?view plaincopy ?
  1. tar?zxvf?make-3.82.tar.gz??
  2. cd?make-3.82??
  3. ./configure??
  4. make??
  5. make?install??
[c-sharp]?view plaincopy ?
  1. tar?zxvf?make-3.82.tar.gz??
  2. cd?make-3.82??
  3. ./configure??
  4. make??
  5. make?install??

?

2.安装bison(最好在编译LAMP前安装好所有基类软件)

下载地址:http://www.gnu.org/software/bison/

?

[c-sharp]?view plaincopy ?
  1. tar?zxvf?bison-2.5.tar.gz??
  2. cd?bison-2.5??
  3. ./configure??
  4. make??
  5. make?install??
[c-sharp]?view plaincopy ?
  1. tar?zxvf?bison-2.5.tar.gz??
  2. cd?bison-2.5??
  3. ./configure??
  4. make??
  5. make?install??

?

3.安装gcc-c++

下载地址:http://www.gnu.org/software/gcc/

?

[c-sharp]?view plaincopy ?
  1. tar?zxvf?gcc-c++-4.4.4.tar.gz??
  2. cd?gcc-c++-4.4.4??
  3. ./configure??
  4. make??
  5. make?install??
[c-sharp]?view plaincopy ?
  1. tar?zxvf?gcc-c++-4.4.4.tar.gz??
  2. cd?gcc-c++-4.4.4??
  3. ./configure??
  4. make??
  5. make?install??

?

?

4.安装cmake(请下载最新版本安装)

下载地址:http://www.cmake.org/

?

[c-sharp]?view plaincopy ?
  1. tar?zxvf?cmake-2.8.4.tar.gz??
  2. cd?cmake-2.8.4??
  3. ./configure??
  4. make??
  5. make?install??
[c-sharp]?view plaincopy ?
  1. tar?zxvf?cmake-2.8.4.tar.gz??
  2. cd?cmake-2.8.4??
  3. ./configure??
  4. make??
  5. make?install??

?

5.安装ncurses

下载地址:http://www.gnu.org/software/ncurses/

?

[c-sharp]?view plaincopy ?
  1. tar?zxvf?ncurses-5.8.tar.gz??
  2. cd?ncurses-5.8??
  3. ./configure??
  4. make??
  5. make?install??
[c-sharp]?view plaincopy ?
  1. tar?zxvf?ncurses-5.8.tar.gz??
  2. cd?ncurses-5.8??
  3. ./configure??
  4. make??
  5. make?install??

?

?

开始安装MySQL,下载地址:http://dev.mysql.com/

这里我在这里下载的mysql-5.6.12.tar.gz

ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.6/

准备工作

?

[c-sharp]?view plaincopy ?
  1. groupadd?mysql??
  2. useradd mysql -g mysql -M -s /sbin/nologin??
    #增加一个名为CentOS Mysql的用户。

    -g:指定新用户所属的用户组(group)

    -M:不建立根目录

    -s:定义其使用的shell,/sbin/nologin代表用户不能登录系统

[c-sharp]?view plaincopy ?
  1. groupadd?mysql??
  2. useradd?-r?-g?mysql?mysql??

?

解压并安装MySQL

?

[c-sharp]?view plaincopy ?
  1. tar?zxvf?mysql-5.6.12.tar.gz??
  2. cd?mysql-5.6.12? (以下是一行 这里为了方便大家理解和注释写成换行注释,实际编译中请在换行前 加 " \ "链接)cmake \
    -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ ? #安装路径
    -DMYSQL_DATADIR=/usr/local/mysql/data?????? \ ?? #数据文件存放位置
    -DSYSCONFDIR=/etc????????????? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ?????? #my.cnf路径
    -DWITH_MYISAM_STORAGE_ENGINE=1??? \ ????? #支持MyIASM引擎
    -DWITH_INNOBASE_STORAGE_ENGINE=1 \ ??? #支持InnoDB引擎
    -DWITH_MEMORY_STORAGE_ENGINE=1 \ ?????? #支持Memory引擎
    -DWITH_READLINE=1??????????????????? \ ? ? ? ? ? ? ? ? ? ? ? ? #快捷键功能(我没用过)
    -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock????? \?? #连接数据库socket路径
    -DMYSQL_TCP_PORT=3306????????????????? \ ? ? ? ? ? ??? #端口
    -DENABLED_LOCAL_INFILE=1??????????? \ ? ? ? ? ? ? ?? #允许从本地导入数据
    -DWITH_PARTITION_STORAGE_ENGINE=1? \ ? #安装支持数据库分区
    -DEXTRA_CHARSETS=all????????????????? \ ? ? ? ? ? ? ? ? ? #安装所有的字符集
    -DDEFAULT_CHARSET=utf8????????????? \ ? ? ? ? ? ? ?? ?? #默认字符
    -DDEFAULT_COLLATION=utf8_general_ci


  3. make??
  4. make?install??

?

完成后,继续下面的操作

?

[c-sharp]?view plaincopy ?
  1. cd?/usr/local/mysql??
  2. chown -R mysql:mysql . (为了安全安装完成后请修改权限给root用户)
  3. scripts/mysql_install_db?--user=mysql (先进行这一步再做如下权限的修改)
  4. chown?-R root:mysql?.? (将权限设置给root用户,并设置给mysql组, 取消其他用户的读写执行权限,仅留给mysql "rx"读执行权限,其他用户无任何权限)
  5. chown -R mysql:mysql ./data ? (给数据库存放目录设置成mysql用户mysql组,并赋予chmod -R ug+rwx? 读写执行权限,其他用户权限一律删除仅给mysql用户权限)
[c-sharp]?view plaincopy ?
  1. cd?/usr/local/mysql??
  2. chown?-R?mysql?.??
  3. chgrp?-R?mysql?.??
  4. scripts/mysql_install_db?--user=mysql??
  5. chown?-R?root?.??

?

下面的命令是可选的,将mysql的配置文件拷贝到/etc

?

[c-sharp]?view plaincopy ?
  1. cp?support-files/my-medium.cnf?/etc/my.cnf? (原始老版本是此操作,5.6.12版本的是如下文件地址)
  2. cp?support-files/my-default.cnf? /etc/my.cnf? (并给/etc/my.cnf +x权限 同时删除 其他用户的写权限,仅仅留给root 和工作组 rx权限,其他一律删除连rx权限都删除)
[c-sharp]?view plaincopy ?
  1. cp?support-files/my-medium.cnf?/etc/my.cnf??

?

?

#修改my.cnf配置
??? vim /etc/my.cnf
?? ???
??? #[mysqld] 添加:
??? datadir=/data/mysql
??? default-storage-engine=MyISAM

?

?


启动mysql:

?

[c-sharp]?view plaincopy ?
  1. bin/mysqld_safe?--user=mysql?&??
  2. #启动mysql,看是否成功??
  3. netstat?-tnl|grep?3306??
[c-sharp]?view plaincopy ?
  1. bin/mysqld_safe?--user=mysql?&??
  2. #启动mysql,看是否成功??
  3. netstat?-tnl|grep?3306??

?

上面是一种启动mysql的方法,还有一种简单的方便,如下:

?

[c-sharp]?view plaincopy ?
  1. #将mysql的启动服务添加到系统服务中??
  2. cp?support-files/mysql.server?/etc/init.d/mysql??
  3. #现在可以使用下面的命令启动mysql??
  4. service?mysql start??
  5. #停止mysql服务??
  6. service?mysql stop??
  7. #重启mysql服务??
  8. service?mysql restart??
[c-sharp]?view plaincopy ?
  1. #将mysql的启动服务添加到系统服务中??
  2. cp?support-files/mysql.server?/etc/init.d/mysql.server??
  3. #现在可以使用下面的命令启动mysql??
  4. service?mysql.server?start??
  5. #停止mysql服务??
  6. service?mysql.server?stop??
  7. #重启mysql服务??
  8. service?mysql.server?restart??

?

将mysql服务添加到开机启动项,让mysql服务开机启动

[c-sharp]?view plaincopy ?
  1. chkconfig?--add?mysql

修改默认root账户密码,默认密码为空

修改密码 cd 切换到mysql所在目录?

cd /usr/local/mysql?

#./bin/mysqladmin -u root password?

回车在接下来的提示中设置新密码即可。。

?

? #启动MySQL
?? ?/usr/local/mysql/bin/mysqld_safe –defaults-file=/etc/my.cnf &
?? ?#或者
?? ?/etc/init.d/mysql start (service mysql start)
?? ? ?
?? ?#测试MySQL是否启动
?? ?# 1)查看是否有进程mysql
?? ?ps -ef | grep mysql
?? ?# 2)查看端口是否运行
?? ?netstat -tnl | grep 3306
?? ?# 3)读取mysql版本信息
?? ?mysqladmin version

?

转自:http://blog.csdn.net/zqtsx/article/details/9378703

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
在MySQL中使用视图的局限性是什么?在MySQL中使用视图的局限性是什么?May 14, 2025 am 12:10 AM

mysqlviewshavelimitations:1)他们不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinSorsubqueries.2)他们canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

确保您的MySQL数据库:添加用户并授予特权确保您的MySQL数据库:添加用户并授予特权May 14, 2025 am 12:09 AM

porthusermanagementInmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

哪些因素会影响我可以在MySQL中使用的触发器数量?哪些因素会影响我可以在MySQL中使用的触发器数量?May 14, 2025 am 12:08 AM

mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)复杂的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)

mysql:存储斑点安全吗?mysql:存储斑点安全吗?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

mySQL:通过PHP Web界面添加用户mySQL:通过PHP Web界面添加用户May 14, 2025 am 12:04 AM

通过PHP网页界面添加MySQL用户可以使用MySQLi扩展。步骤如下:1.连接MySQL数据库,使用MySQLi扩展。2.创建用户,使用CREATEUSER语句,并使用PASSWORD()函数加密密码。3.防止SQL注入,使用mysqli_real_escape_string()函数处理用户输入。4.为新用户分配权限,使用GRANT语句。

mysql:blob和其他无-SQL存储,有什么区别?mysql:blob和其他无-SQL存储,有什么区别?May 13, 2025 am 12:14 AM

mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而alenosqloptionslikemongodb,redis和calablesolutionsoluntionsoluntionsoluntionsolundortionsolunsolunsstructureddata.blobobobsimplobissimplobisslowderperformandperformanceperformancewithlararengelitiate;

mySQL添加用户:语法,选项和安全性最佳实践mySQL添加用户:语法,选项和安全性最佳实践May 13, 2025 am 12:12 AM

toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

MySQL:如何避免字符串数据类型常见错误?MySQL:如何避免字符串数据类型常见错误?May 13, 2025 am 12:09 AM

toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollat​​ionsEttingsefectery.1)usecharforfixed lengengters lengengtings,varchar forbariaible lengength,varchariable length,andtext/blobforlabforlargerdata.2 seterters seterters seterters seterters

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

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

螳螂BT

螳螂BT

Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

EditPlus 中文破解版

EditPlus 中文破解版

体积小,语法高亮,不支持代码提示功能

Dreamweaver Mac版

Dreamweaver Mac版

视觉化网页开发工具

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器

WebStorm Mac版

WebStorm Mac版

好用的JavaScript开发工具