搜索
首页数据库mysql教程MYSQL完全安装使用指南_MySQL

mysql安装笔记


学习了很长时间的linux,有必要做一下整理笔记了,以下是mysql的安装笔记,和常见的一些使用方法。
因我喜欢调试优化系统,所以在编译安装时使用了一些选项增加编程后程序的执行效率,有些可能我理解有错,希望大家指出.

●安装mysql
# tar zxvf mysql-4.0.14.tar.gz -C /setup
# cd /setup/mysql-4.0.14
# groupadd mysql
# useradd mysql -g mysql -M -s /bin/false
# ./configure --prefix=/web/mysql / 指定安装目录
      --without-debug /去除debug模式
      --with-extra-charsets=gb2312 /添加gb2312中文字符支持
      --enable-assembler /使用一些字符函数的汇编版本
      --without-isam /去掉isam表类型支持 现在很少用了 isam表是一种依赖平台的表
      --without-innodb /去掉innodb表支持 innodb是一种支持事务处理的表,适合企业级应用
      --with-pthread /强制使用pthread库(posix线程库)
      --enable-thread-safe-client /以线程方式编译客户端
      --with-client-ldflags=-all-static /
      --with-mysqld-ldflags=-all-static /以纯静态方式编译服务端和客户端       --with-raid /激活raid支持
     
# make
# make install       
# scripts/mysql_install_db /生成mysql用户数据库和表文件
# cp support-files/my-medium.cnf /etc/my.cnf /copy配置文件,有large,medium,small三个环境下的,根据机器性能选择,如果负荷比较大,可修改里面的一些变量的内存使用值
# cp support-files/mysql.server /etc/init.d/mysqld  /copy启动的mysqld文件
# chmod 700 /etc/init.d/mysqld
# cd /web
# chmod 750 mysql -R
# chgrp mysql mysql -R
# chown mysql mysql/var -R
# cd /web/mysql/libexec
# cp mysqld mysqld.old
# strip mysqld
# chkconfig --add mysqld
# chkconfig --level 345 mysqld on
# service mysqld start
# netstat -atln
看看有没有3306的端口打开,如果mysqld不能启动,看看/web/mysql/var下的出错日志,一般都是目录权限没有设置好的问题
# ln -s /web/mysql/bin/mysql /sbin/mysql
# ln -s /web/mysql/bin/mysqladmin /sbin/mysqladmin
# mysqladmin -uroot password "youpassword" #设置root帐户的密码
# mysql -uroot -p
# 输入你设置的密码
mysql>use mysql;
mysql>delete from user where password=""; #删除用于本机匿名连接的空密码帐号
mysql>flush privileges;
mysql>quit

●安装DBI和DBD for mysql 用于提供perl访问mysql数据库的接口规范,请确认你已经安装了perl,一般默认系统都装上了

# cd /setup
# tar zxvf DBD-mysql-2.9002.tar.gz -C /setup
# tar zxvf DBI-1.38.tar.gz -C /setup
# cd DBI-1.38
# perl Makefile.PL
# make 
# make test
# make install
因为有的perl程序中perl的路径是/usr/local/bin/perl,而红帽系统默认是/usr/bin/perl,所以最好做一个连接,保证兼容性
# ln -s /usr/bin/perl /usr/local/bin/perl
# cd ../DBD-mysql-2.9002
生成安装配置文件需要在perl Makefile.PL后添加一些参数,比较麻烦,我们可以通过添加一个到/web/mysql/bin/mysql_config这个程序的连接解决问题
系统会自动寻找这个命令生成安装所需要的数据库参数
# ln -s /web/mysql/bin/mysql_config  /sbin/mysql_config
# perl Makefile.PL
# make 
# make instll (这里make test我总是运行一半就出错,但是安装后是可以运行mysql目录下的测试脚本,不知道3.x的mysql如何)
现在你可以运行测试脚本了,不过速度很慢,挂在后台好了
# perl /web/mysql/sql-bench/run-all-tests --user=root --password="youpassword"


附:
●mysql常见的一些有用的选项和命令
mysqld -----开启日志支持
--log 
--log-update
--log-long-formart
●mysql
grant all on database.* to user identified by "password" 新建一user用户,赋予其database数据库的所有权限
revoke all on database from user 移除user用户在database数据库上的所有权限
mysql -uroot -p --one-database databasename ●mysqladmin
mysqladmin flush-logs 命令mysqld重新打开一个新的日志文件,就是清空老日志文件,相当于轮回了
●mysqldump 
--add-drop-table 导出sql语句时添加droptable if exists语句
--quick 快速导出
--opt  优化选项(推荐)
●myisamchk
检查表选项
--extend-check 扩展检查
--medium-check 速度比较折中的一个检查选项
修复表选项
--recover 修复表文件
--safe-recover 安全修复表文件,比--recover要慢
修饰修复表项
--force 强制清除上次的临时文件
--quick 只根据素引文件的内容进行修复
●mysql的管理
可以使用phpmyadmin(需要php的环境支持)和mysqlcc(linux图形界面支持,WINDOWS系统支持

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系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

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

热门文章

热工具

Dreamweaver Mac版

Dreamweaver Mac版

视觉化网页开发工具

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

功能强大的PHP集成开发环境

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

WebStorm Mac版

WebStorm Mac版

好用的JavaScript开发工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

将Eclipse与SAP NetWeaver应用服务器集成。