search
HomeDatabaseMysql TutorialMySQL SUSE SLES11安装与配置笔记实操

以下的文章主要介绍的是MySQL SUSE SLES11安装与配置笔记的实际操作过程,我们是在Linux下两个不同的版本MySQL安装实战(MySQL5和MySQL4)演示,以下就是文章的而具体内容描述。 Redhat9.2 安装MySQL5.0 fedora7安装MySQL (1) 下载 从MySQL官网 下载到最新的

以下的文章主要介绍的是MySQL SUSE SLES11安装与配置笔记的实际操作过程,我们是在Linux下两个不同的版本MySQL安装实战(MySQL5和MySQL4)演示,以下就是文章的而具体内容描述。

Redhat9.2 安装MySQL5.0

fedora7安装MySQL

(1) 下载

从MySQL官网 下载到最新的发行版本5.1.45,简单起见,直接下载SLES11的RPM版本:

<ol class="dp-xml">
<li class="alt">MySQL<span>-server-community-5.1.45-1.sles11.i586.rpm  </span>
</li>
<li>MySQL<span>-client-community-5.1.45-1.sles11.i586.rpm  </span>
</li>
<li class="alt">MySQL<span>-shared-community-5.1.45-1.sles11.i586.rpm </span>
</li>
</ol>

对MySQL版本的选择,个人意见,如果是作为产品首先考虑稳定性和性能,功能够用即可,版本上谨慎保守一些,但是作为一般开发用用,追追新也无所谓。

(2) MySQL SUSE SLES11 安装

1. rpm安装

<ol class="dp-xml">
<li class="alt"><span>执行:rpm -ivh MySQL-server-community-5.1.45-1.sles11.i586.rpm  </span></li>
<li><span>Preparing... ########################################### [100%]  </span></li>
<li class="alt">
<span>1:</span>MySQL<span>-server-community ########################################### [100%]  </span>
</li>
<li>MySQL<span> 0:off 1:off 2:on 3:on 4:on 5:on 6:off  </span>
</li>
<li class="alt">
<span>PLEASE REMEMBER TO SET A PASSWORD FOR THE </span>MySQL<span> root USER !  </span>
</li>
<li><span>To do so, start the server, then issue the following commands:  </span></li>
<li class="alt">
<span>/usr/bin/</span>MySQL<span>admin -u root password 'new-password'  </span>
</li>
<li>
<span>/usr/bin/</span>MySQL<span>admin -u root -h ss-server password 'new-password'  </span>
</li>
<li class="alt"><span>Alternatively you can run:  </span></li>
<li>
<span>/usr/bin/</span>MySQL<span>_secure_installation  </span>
</li>
<li class="alt"><span>which will also give you the option of removing the test  </span></li>
<li><span>databases and anonymous user created by default. This is  </span></li>
<li class="alt"><span>strongly recommended for production servers.  </span></li>
<li><span>See the manual for more instructions.  </span></li>
<li class="alt">
<span>Please report any problems with the /usr/bin/</span>MySQL<span>bug script!  </span>
</li>
<li>
<span>Starting </span>MySQL<span>. done  </span>
</li>
<li class="alt">
<span>Giving </span>MySQL<span>d 2 seconds to start   </span>
</li>
</ol>

使用ps -ef | grep MySQL 可以看到msyqld进行已经启动。netstat -nat 可以看到默认的3306端口已经在监听。rpm的安装的确是够简单。

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN

但是这样的默认安装,是没有指定安装路径的,因此MySQL不会MySQL SUSE SLES11 安装到我们期望的地点。因此只好重新来过,先卸载吧:

rpm -e MySQL-server-community-5.1.45-1.sles11

使用--prefix选项重新安装:

rpm -ivh --prefix=/work/soft/database/MySQL/ MySQL-server-community-5.1.45-1.sles11.i586.rpm

结果发生错误:

<ol class="dp-xml"><li class="alt"><span>error: package MySQL-server-community is not relocatable  </span></li></ol>

居然不能重新定位MySQL SUSE SLES11 安装路径,这个就麻烦了。只好重新下载tarbell的版本MySQL-5.1.45.tar.gz,自己动手编译。

2. 编译

./configure --prefix=/work/soft/database/MySQL/MySQL5.1 --localstatedir=/work/soft/database/MySQL/MySQLdata --with-charset=utf8 --with-extra-charsets=all --with-client-ldflags=-all-static --with-MySQLd-ldflags=-all-static --with-unix-socket-path=/work/soft/database/MySQL/tmp/MySQL.sock

configure的过程中出现错误而中断:

<ol class="dp-xml"><li class="alt"><span><span>checking for termcap functions library... configure: error: No curses/termcap library found </span></span></li></ol>

先把这个东西装好

<ol class="dp-xml">
<li class="alt"><span><span>gunzip ncurses-5.7.tar.gz  </span></span></li>
<li><span>tar xvf ncurses-5.7.tar  </span></li>
<li class="alt"><span>cd ncurses-5.7/  </span></li>
<li><span>./configure  </span></li>
<li class="alt"><span>make  </span></li>
<li><span>make install </span></li>
</ol>

安装ncurses之后,重新configure成功,继续make,make install完成编译MySQL SUSE SLES11 安装。

然后执行scripts/MySQL_install_db.

<ol class="dp-xml">
<li class="alt"><span>Installing MySQL system tables...  </span></li>
<li><span>OK  </span></li>
<li class="alt"><span>Filling help tables...  </span></li>
<li><span>OK  </span></li>
<li class="alt">
<span>To start </span>MySQL<span>d at boot time you have to copy  </span>
</li>
<li>
<span>support-files/</span>MySQL<span>.server to the right place for your system  </span>
</li>
<li class="alt">
<span>PLEASE REMEMBER TO SET A PASSWORD FOR THE </span>MySQL<span> root USER !  </span>
</li>
<li><span>To do so, start the server, then issue the following commands:  </span></li>
<li class="alt">
<span>/work/soft/database/</span>MySQL<span>/</span>MySQL<span>5.1/bin/</span>MySQL<span>admin -u root password 'new-password'  </span>
</li>
<li>
<span>/work/soft/database/</span>MySQL<span>/</span>MySQL<span>5.1/bin/</span>MySQL<span>admin -u root -h ss-server password 'new-password'  </span>
</li>
<li class="alt"><span>Alternatively you can run:  </span></li>
<li>
<span>/work/soft/database/</span>MySQL<span>/</span>MySQL<span>5.1/bin/</span>MySQL<span>_secure_installation  </span>
</li>
<li class="alt"><span>which will also give you the option of removing the test  </span></li>
<li><span>databases and anonymous user created by default. This is  </span></li>
<li class="alt"><span>strongly recommended for production servers.  </span></li>
<li><span>See the manual for more instructions.  </span></li>
<li class="alt">
<span>You can start the </span>MySQL<span> daemon with:  </span>
</li>
<li>
<span>cd /work/soft/database/</span>MySQL<span>/</span>MySQL<span>5.1 ; /work/soft/database/</span>MySQL<span>/</span>MySQL<span>5.1/bin/</span>MySQL<span>d_safe &  </span>
</li>
<li class="alt">
<span>You can test the </span>MySQL<span> daemon with </span>MySQL<span>-test-run.pl  </span>
</li>
<li>
<span>cd /work/soft/database/</span>MySQL<span>/</span>MySQL<span>5.1/</span>MySQL<span>-test ; perl </span>MySQL<span>-test-run.pl  </span>
</li>
<li class="alt">
<span>Please report any problems with the /work/soft/database/</span>MySQL<span>/</span>MySQL<span>5.1/bin/</span>MySQL<span>bug script!   </span>
</li>
</ol>

接着很重要的事情,设置MySQLd的开机启动:

<ol class="dp-xml">
<li class="alt">
<span>cp support-files/MySQL.server /etc/init.d/</span>MySQL<span>  </span>
</li>
<li>
<span>chkconfig </span>MySQL<span> on  </span>
</li>
</ol>

为了方便,将MySQL 的bin目录加到PATH中,在/etc/profile中加入myslq/bin,顺便增加两个别名方便操作:

<ol class="dp-xml">
<li class="alt">export PATH=$JAVA_HOME/bin:$SOFT_ROOT/database/MySQL/MySQL5.1/bin:$PATH  </li>
<li>
<span>alias </span>MySQL<span class="attribute">_start</span><span>=</span><span class="attribute-value">"MySQLd_safe&"</span><span> </span>
</li>
<li class="alt">
<span>alias </span>MySQL<span class="attribute">_stop</span><span>=</span><span class="attribute-value">"MySQLadmin -uroot -p shutdown"</span><span> </span>
</li>
</ol>

3. 配置

按照普遍推荐的标准设置,需要增加MySQL的user和group:不过上面的MySQL SUSE SLES11 安装过程结束后,发现已经存在名为MySQL的user和group了:

<ol class="dp-xml">
<li class="alt"><span>ss-server:/etc # groupadd MySQL  </span></li>
<li>
<span>groupadd: Group `</span>MySQL<span>' already exists.  </span>
</li>
<li class="alt">
<span>ss-server:/etc # useradd </span>MySQL<span> -g </span>MySQL<span>  </span>
</li>
<li>
<span>useradd: Account `</span>MySQL<span>' already exists.  </span>
</li>
</ol>

用ps命令可以看到

<ol class="dp-xml">
<li class="alt"><span>ss-server:/etc # ps -ef | grep MySQL  </span></li>
<li>
<span>root 3743 1 0 18:58 ? 00:00:00 /bin/sh <br>/work/soft/database/</span>MySQL<span>/</span>MySQL<span>5.1/bin/</span>MySQL<span>d_safe </span><span class="attribute">--datadir</span><span>=<br>/work/soft/database/</span>MySQL<span>/</span>MySQL<span>data </span><span class="attribute">--pid-file</span><span>=/<br>work/soft/database/</span>MySQL<span>/</span>MySQL<span>data/ss-server.pid  </span>
</li>
<li class="alt">MySQL<span> 3799 3743 0 18:58 ? 00:00:00 /work/soft/database/</span>MySQL<span>/</span>MySQL<span>5.1<br>/libexec/</span>MySQL<span>d </span><span class="attribute">--basedir</span><span>=/work/soft/database/</span>MySQL<span>/</span>MySQL<span>5.1 <br></span><span class="attribute">--datadir</span><span>=/work/soft/database/</span>MySQL<span>/</span>MySQL<span>data </span><span class="attribute">--user</span><span>=</span>MySQL<span> </span><span class="attribute">--log-error<br></span><span>=/work/soft/database/</span>MySQL<span>/</span>MySQL<span>data/ss-server.err </span><span class="attribute">--pid-file</span><span>=/work/soft<br>/database/</span>MySQL<span>/</span>MySQL<span>data/ss-server.pid  </span>
</li>
</ol>

这里MySQLd是以MySQL用户的身份启动的。

以下是标准的MySQL SUSE SLES11 安装设置了

1. 设置root帐户的密码

<ol class="dp-xml"><li class="alt">MySQL<span>admin -u root password 'yourpassword'  </span>
</li></ol>

2. 本机登录MySQL, 需要做的事情有: 删除本机匿名连接的空密码帐号;容许root用户是不允许远程登录。

<ol class="dp-xml"><li class="alt">MySQL<span> -uroot -p </span>
</li></ol>

然后输入上面设置的密码,登录后在MySQL的命令行中执行:

<ol class="dp-xml">
<li class="alt">MySQL<span class="tag">></span>use MySQL;  </li>
<li>MySQL<span class="tag">></span><span>delete from user where </span><span class="attribute">password</span><span>=</span><span class="attribute-value">""</span><span>;  </span>
</li>
<li class="alt">MySQL<span class="tag">></span><span>update user set </span><span class="attribute">host</span><span> = </span><span class="attribute-value">'%'</span><span> where </span><span class="attribute">user</span><span> = </span><span class="attribute-value">'root'</span><span>;  </span>
</li>
<li>MySQL<span class="tag">></span><span>flush privileges;  </span>
</li>
<li class="alt">MySQL<span class="tag">></span><span>quit  </span>
</li>
</ol>

对于root账号,如果考虑安全应该新建其他账号用于远程登录,root账号可以不必开启远程登录。不过对于一般使用,没有太多安全需求,允许root用户远程登录可以方便管理,毕竟使用专用管理软件的图形界面在操作方面要方便的多。


 


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Explain the InnoDB Buffer Pool and its importance for performance.Explain the InnoDB Buffer Pool and its importance for performance.Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL vs. Other Programming Languages: A ComparisonMySQL vs. Other Programming Languages: A ComparisonApr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Learning MySQL: A Step-by-Step Guide for New UsersLearning MySQL: A Step-by-Step Guide for New UsersApr 19, 2025 am 12:19 AM

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL: Essential Skills for Beginners to MasterMySQL: Essential Skills for Beginners to MasterApr 18, 2025 am 12:24 AM

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL: Structured Data and Relational DatabasesMySQL: Structured Data and Relational DatabasesApr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL: Key Features and Capabilities ExplainedMySQL: Key Features and Capabilities ExplainedApr 18, 2025 am 12:17 AM

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

The Purpose of SQL: Interacting with MySQL DatabasesThe Purpose of SQL: Interacting with MySQL DatabasesApr 18, 2025 am 12:12 AM

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

MySQL for Beginners: Getting Started with Database ManagementMySQL for Beginners: Getting Started with Database ManagementApr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.