




已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
2.2.Installing MySQL from Generic Binaries on Unix/LinuxThis section covers the installation of MySQL binary distributions that are provided for various platforms in the form of compressed tar files (files with a .tar.gz extension). To obtain MySQL, see Section2.1.3, “How to Get MySQL”. Oracle provides a set of binary distributions of MySQL. In addition to binaries provided in platform-specific package formats, we offer binary distributions for a number of platforms in the form of compressed tar files (.tar.gz files). For Windows distributions, see Section2.3, “Installing MySQL on Microsoft Windows”. On Unix, a tar file binary distribution is installed by unpacking it at the installation location在linux系统上,安装mysql的二进制tar包,是通过把它解压到你所选择的目录里,并且在那个位置创建如下的目录。 you choose (typically /usr/local/mysql) and creates the following directories in that location. Table2.2.MySQL Installation Layout for Generic Unix/Linux Binary Package看清你下的是哪个版本?不同版本的安装方法是不一样的,比如我看的书网络配置服务搭建、配置、与管理大全上说的,就是在源码解压后还要configure,其实configure也很好理解的,他也是配置文件的一种方法,linux种很大一部分任务就是在配置文件。所以说,你必须看清楚你用的是哪个版本。还有安装源码文件的时候一定要看清楚,它提供的说明文档,耐着性子看下去,他会很有帮助。DirectoryContents of DirectorybinClient programs and the mysqld serverdataLog files, databasesdocsManual in Info formatmanUnix manual pagesincludeInclude (header) fileslibLibrariesscriptsmysql_install_dbshare/mysqlMiscellaneous support files, including error messages, sample configuration files, SQL for database installationsql-benchBenchmarksDebug versions of the mysqld binary are available as mysqld-debug. To compile a debug version of MySQL from a source distribution, you should add -with-debug or -with-debug=full to the configure command used to configure the distribution and remove any -fomit-frame-pointer options. For more information on compiling from source, see Section2.11, “Installing MySQL from a Source Distribution”. MySQL tar file binary distributions have names of the form mysql-VERSION-OS.tar.gz, where VERSION is a number (for example, 5.1.54), and OS indicates the type of operating system for which the distribution is intended (for example, pc-linux-i686). In addition to these generic packages, we also offer binaries in platform-specific package formats for selected platforms. See the platform-specific sections for more information on how to install these. You need the following tools to install a MySQL tar file binary distribution: GNU gunzip to uncompress the distribution. A reasonable tar to unpack the distribution. GNU tar is known to work. Some operating systems come with a preinstalled version of tar that is known to have problems. For example, the tar provided with early versions of Mac OS X, SunOS 4.x, Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX are known to have problems with long file names. On Mac OS X, you can use the preinstalled gnutar program. On Solaris 10 and OpenSolaris you can use the preinstalled gtar. On other systems with a deficient tar, you should install GNU tar first. Warning 以前安装过的话,你要先把它彻底删除。If you have previously installed a MySQL installation using your operating system native package management system, such as yum or apt-get, you may experience problems installing using a native binary. Make sure your previous MySQL previous installation has been removed entirely (using your package management system), and that any additional files, such as old versions of your data files, have also been removed. You should also check the existence of configuration files such as /etc/f or the /etc/mysql directory have been deleted. If you run into problems and need to file a bug report, please use the instructions in Section1.7, “How to Report Bugs or Problems”. The basic commands that you must execute to install and use a MySQL binary distribution are shown following. NoteThe following process assumes that you have root (administrator) access to your system. Alternatively you can prefix each command using the sudo (Linux) or pfexec (OpenSolaris) command. This procedure does not set up any passwords for MySQL accounts. After following the procedure, proceed to Section2.12, “Post-Installation Setup and Testing”. shell groupadd mysqlshell useradd -r -g mysql mysqlshell cd /usr/localshell gunzip ln -s full-path-to-mysql-VERSION-OS mysqlshell cd mysqlshell chown -R mysql .shell chgrp -R mysql .shell scripts/mysql_install_db -user=mysqlshell chown -R root .shell chown -R mysql datashell cp /usr/local/mysql/support-files/my-small/etc/f # Optionalshell bin/mysqld_safe -user=mysql &shell cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql.server # Optional把msql的脚本文件拷到系统的启动目录下A more detailed version of the preceding description for installing a binary distribution follows. NoteThe following process assumes that you have root (administrator) access to your system. Alternatively you can prefix each command using the sudo (Linux) or pfexec (OpenSolaris) command. This procedure does not set up any passwords for MySQL accounts. After following the procedure, proceed to Section2.12, “Post-Installation Setup and Testing”. 1. If your system does not already have a user and group for mysqld to run as, you may need to create one. 如果没有作为mysqld服务的用户跟组的话,你要创建一个。因为linux下每个服务都是属于一定的用户跟组的。不信你打PS看看。2. shell groupadd mysql 创建mysql组3. shell useradd -r -g mysql mysql 创建系统用户mysql并且属于mysql组NoteThe above will create a user that has login permissions to your server. You may wish to disable the account, as the user is only required for ownership, not login, purposes. You can do this on Linux by using the -r command-line option. 后面再加-m参数可以给mysql制定一个家目录These commands add the mysql group and the mysql user. The syntax for useradd and groupadd may differ slightly on different versions of Unix, or they may have different names such as adduser and addgroup. You might want to call the user and group something else instead of mysql. If so, substitute the appropriate name in the following steps. 4. Pick the directory under which you want to unpack the distribution and change location into it. In the following example, we unpack the distribution under /usr/local. (The instructions, therefore, assume that you have permission to create files and directories in /usr/local. If that directory is protected, you must perform the installation as root.) 5. shell cd /usr/local6. Obtain a distribution file using the instructions in Section2.1.3, “How to Get MySQL”. For a given release, binary distributions for all platforms are built from the same MySQL source distribution. 7. Unpack the distribution, which creates the installation directory.解压这个发行版,这发型版自动就生成了安装目录。 Then create a symbolic link to that directory: 8. shell gunzip ln -s full-path-to-mysql-VERSION-OS mysql做一个软连接,你要知道软连接与硬链接的区别。 10. The tar command creates a directory named mysql-VERSION-OS. The ln command makes a symbolic link to that directory. This lets you refer more easily to the installation directory as /usr/local/mysql. With GNU tar, no separate invocation of gunzip is necessary. You can replace the first line with the following alternative command to uncompress and extract the distribution: shell tar zxvf /path/to/mysql-VERSION-OS.tar.gz11. Change location into the installation directory: 12. shell cd mysqlYou will find several files and subdirectories in the mysql directory. The most important for installation purposes are the bin and scripts subdirectories: 这两个目录最重要,你要把bin目录加到环境变量里面。而脚本scripts目录里面包含了初始化mysql数据库的脚本命令,这个mysql数据库里存放着服务器访问权限的grant表 The bin directory contains client programs and the server. You should add the full path name of this directory to your PATH environment variable so that your shell finds the MySQL programs properly. See Section2.14, “Environment Variables”. The scripts directory contains the mysql_install_db script used to initialize the mysql database containing the grant tables that store the server access permissions. 13. Ensure that the distribution contents are accessible to mysql. If you unpacked the distribution as mysql, no further action is required. If you unpacked the distribution as root, its contents will be owned by root. Change its ownership to mysql by executing the following commands as root in the installation directory: 14. shell chown -R mysql .15. shell chgrp -R mysql .The first command changes the owner attribute of the files to the mysql user. The second changes the group attribute to the mysql group. 16. If you have not installed MySQL before, you must create the MySQL data directory and initialize the grant tables: 初始化数据库17. shell scripts/mysql_install_db -user=mysqlIf you run the command as root, include the -user option as shown. If you run the while logged in as that user, you can omit the -user option. The command should create the data directory and its contents with mysql as the owner. After creating or updating the grant tables, you need to restart the server manually. 18. Most of the MySQL installation can be owned by root if you like. The exception is that the data directory must be owned by mysql. To accomplish this, run the following commands as root in the installation directory: 19. shell chown -R root .20. shell chown -R mysql data21. You may want to optionally copy one of the provided configuration files from the support-files directory into your /etc/ directory. There are different sample configuration files for different use cases, server types, and CPU and RAM configurations. If you want to use one of these standard files, you should copy it to /etc/f, or /etc/mysql/f and edit and check the configuration before starting your MySQL server for the first time. If you do not copy one of the standard configuration files, the MySQL server will be started with the default settings. 22. If the plugin directory is writable by the server, it may be possible for a user to write executable code to a file in the directory using SELECT . INTO DUMPFILE. This can be prevented by making plugin_dir read only to the server or by setting -secure-file-priv to a directory where SELECT writes can be made safely. 23. If you want MySQL to start automatically when you boot your machine, you can copy support-files/mysql.server to the location where your system has its startup files. More information can be found in the support-files/mysql.server script itself and in Section, “Starting and Stopping MySQL Automatically”. 而我也放了,为什么不能自动启动呢?并且用mysqld也不行,只能用mysqld_safe&在后台启动? 这是为什么?费解啊!24. You can set up new accounts using the bin/mysql_setpermission script if you install the DBI and DBD:mysql Perl modules. See Section4.6.14, “mysql_setpermission Interactively Set Permissions in Grant Tables”. For Perl module inst
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025赤峰新正电工技术服务有限公司面向社会招聘69人考前自测高频考点模拟试题及答案详解一套
- 2025年新乡市诚城卓人学校招聘教师若干名考前自测高频考点模拟试题及一套参考答案详解
- 2025年攀枝花市盐边县事业单位春季引才考核的考前自测高频考点模拟试题及答案详解(典优)
- 2025黑龙江鸡西市社会治安综合治理中心招聘公益性岗位1人考前自测高频考点模拟试题及答案详解(名校卷)
- 贵州国企招聘2025贵州金融控股集团有限责任公司招聘27人笔试历年参考题库附带答案详解
- 浙江国企招聘2025宁波市轨道交通物产置业有限公司下属项目公司社会招聘2人笔试历年参考题库附带答案详解
- 2025陕西汉德车桥有限公司招聘笔试历年参考题库附带答案详解
- 2025重庆电子口岸中心劳务派遣人员招聘笔试历年参考题库附带答案详解
- 2025郑煤机春季招聘笔试历年参考题库附带答案详解
- 2025资兴市湖南东江湖食材供应链有限公司招聘工作人员14人笔试历年参考题库附带答案详解
- 抖音带货考试题目及答案内衣
- 2025四川能投合江电力有限公司员工招聘11人笔试备考题库及答案解析
- 2026届广州市高三年级阶段训练(8月市调研摸底) 数学试卷(含答案解析)
- 医院非暴力沟通小讲课
- 2025至2030年中国山西省房地产行业发展监测及投资前景展望报告
- 第4课洋务运动与边疆危机(任务型导学案)(原卷版)
- 创建文明班级班会课件
- 2025年新修订治安管理处罚法课件
- 社会渠道支撑管理制度
- DBJ50-T-047-2024 建筑地基基础设计标准
- 呼吸科出科小讲课
评论
0/150
提交评论