centos 6.5 32位 编译安装Mysql
CentOS
groupadd mysql #添加mysql组 useradd -g mysql mysql -s /bin/false #创建用户mysql并加入到mysql组,不允许mysql用户直接登录系统 mkdir -p /data/mysql #创建MySQL数据库存放目 chown -R mysql:mysql /data/mysql #设置MySQL数据库目录权限 mkdir -p /usr/local/mysql #创建MySQL安装目录 cd /opttar zxvf mysql-5.5.35.tar.gzcd mysql-5.5.35cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql /-DMYSQL_UNIX_ADDR=/tmp/mysql.sock /-DDEFAULT_CHARSET=utf8 /-DDEFAULT_COLLATION=utf8_general_ci / -DWITH_EXTRA_CHARSETS=all / -DWITH_MYISAM_STORAGE_ENGINE=1 /-DWITH_INNOBASE_STORAGE_ENGINE=1 /-DWITH_MEMORY_STORAGE_ENGINE=1 /-DWITH_READLINE=1 /-DENABLED_LOCAL_INFILE=1 /-DMYSQL_DATADIR=/data/mysql /-DMYSQL_USER=mysql /-DMYSQL_TCP_PORT=3306 /-DSYSCONFDIR=/etc /-DINSTALL_SHAREDIR=share
make && make install 待安装完以后开始配置MySQL: cp ./support-files/my-huge.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可) vi /etc/my.cnf #编辑配置文件,在 [mysqld] 部分增加下面一行 datadir = /data/mysql #添加MySQL数据库路径 :wq! #保存退出 cd /usr/local/mysql<br>启动mysql的时候我希望将数据库的数据文件放在另外一个目录下面,启动命令修改为:注意:实例目录,,安装的时候在此出现了错误。<br>shell>/usr/local/mysql/bin/mysqld_safe --user=mysql --log-error=/u01/mysql/mysql_error/error --datadir=/data/mysql/<br><br>这个时候就出现问题了, <br>因为在进行初始化数据库权限表的那一步的时候默认创建的权限表在默认目录/usr/local/mysql/var下面,这就造成了,上面的错误无法找到权限表:Can't <br>open and lock privilege tables: Table 'mysql.host' doesn't exist<br>./scripts/mysql_install_db --user=mysql --datadir=/data/mysql #生成mysql系统数据库 注意:由于数据库需要保存在另一个目录 在运行初始化权限表的时候使用增加参数--datadir<br><br><br>cp ./support-files/mysql.server /etc/rc.d/init.d/mysql #把Mysql加入系统启动 <br>chmod 755 /etc/init.d/mysql #增加执行权限 <br>chkconfig mysql on #加入开机启动 vi /etc/rc.d/init.d/mysql #编辑 basedir = /usr/local/mysql #MySQL程序安装路径 datadir = /data/mysql #MySQl数据库存放目录 service mysqld start #启动 vi /etc/profile #把mysql服务加入系统环境变量:在最后添加下面这一行 export PATH=$PATH:/usr/local/mysql/bin :wq! #保存退出
下面这行把myslq的库文件链接到系统默认的位置,这样你在编译类似PHP等软件时可以不用指定mysql的库文件地址。 ln -s /usr/local/mysql/include/mysql /usr/include/mysql reboot #需要重启系统,等待系统重新启动之后继续在终端命令行下面操作 mysql_secure_installation #设置Mysql密码 根据提示按Y 回车 然后输入2次密码 继续按Y 回车,直到设置完成 或者直接修改密码/usr/local/mysql/bin/mysqladmin -u root -p password "123456" #修改密码 service mysqld restart #重启 到此,mysql安装完成!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

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.

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance and transaction processing.

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.
