Full MYSQL installation guide _ MySQL

Source: Internet
Author: User
MYSQL installation guide


After learning linux for a long time, it is necessary to take notes. The following are mysql installation notes and common usage methods.
Because I like debugging and optimizing the system, I used some options during compilation and installation to increase the execution efficiency of the program after programming. some of them may be wrong. I hope you can point it out.

● Install 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/specify the installation directory
-- Without-debug/Remove debug mode
-- With-extra-charsets = gb2312/added support for gb2312 Chinese characters
-- Enable-javaser/Assembly version that uses some character functions
-- Without-isam/remove the isam table type. Currently, the isam table is rarely used as a platform-dependent table.
-- Without-innodb/remove innodb tables. innodb is a table that supports transaction processing and is suitable for enterprise-level applications.
-- With-pthread/force use of the pthread Library (posix Thread Library)
-- Enable-thread-safe-client/compile the client in thread mode
-- With-client-ldflags =-all-static/
-- With-mysqld-ldflags =-all-static/compile server and client in pure static mode -- with-raid/activate raid support

# Make
# Make install
# Scripts/mysql_install_db/generate mysql User Database and table files
# Cp support-files/my-medium.cnf/etc/my. the cnf/copy configuration file is available in three environments: large, medium, and small. depending on the machine performance, if the load is heavy, you can modify the memory usage values of some variables.
# Cp support-files/mysql. server/etc/init. d/mysqld/copy mysqld file started
# Chmod 700/etc/init. d/mysqld
# Cd/web
# Chmod 750 mysql-R
# Chgrp mysql-R
# Chown mysql/var-R
# Cd/web/mysql/libexec
# Cp mysqld. old
# Strip mysqld
# Chkconfig -- add mysqld
# Chkconfig -- level 345 mysqld on
# Service mysqld start
# Netstat-atln
Check whether Port 3306 is enabled. if mysqld cannot be started, check the error logs in/web/mysql/var. this is generally because the directory permission is not set.
# Ln-s/web/mysql/bin/mysql/sbin/mysql
# Ln-s/web/mysql/bin/mysqladmin/sbin/mysqladmin
# Mysqladmin-uroot password "youpassword" # set the password of the root account
# Mysql-uroot-p
# Enter your password
Mysql> use mysql;
Mysql> delete from user where password = ""; # delete an empty password account used for anonymous local connection
Mysql> flush privileges;
Mysql> quit

● Install DBI and DBD for mysql to provide the interface specifications for perl to access the mysql database. Make sure you have installed perl. generally, it is installed on the default system.

# 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
In some perl programs, the path of perl is/usr/local/bin/perl, and the default path of the Red Hat system is/usr/bin/perl. Therefore, it is best to establish a connection to ensure compatibility.
# Ln-s/usr/bin/perl/usr/local/bin/perl
# Cd ../DBD-mysql-2.9002
Some parameters need to be added after perl Makefile. PL to generate the installation configuration file, which is troublesome. we can solve the problem by adding a connection to the/web/mysql/bin/mysql_config program.
The system will automatically search for the database parameters required for the command generation and installation.
# Ln-s/web/mysql/bin/mysql_config/sbin/mysql_config
# Perl Makefile. PL
# Make
# Make instll)
Now you can run the test script, but the speed is very slow.
# Perl/web/mysql/SQL-scripts/run-all-tests -- user = root -- password = "youpassword"


Appendix:
● Some common mysql options and commands
Mysqld ----- enable log support
-- Log
-- Log-update
-- Log-long-formart
● Mysql
Grant all on database. * to user identified by "password" create a user and grant all permissions to the database.
Revoke all on database from user removes all permissions of the user on the database
Mysql-uroot-p -- one-database databasename <file. SQL: import the SQL statement from the file. SQL file to the database databasename
● Mysqladmin
Mysqladmin flush-logs command mysqld re-opens a new log file, that is, clearing the old log file, which is equivalent to a loop
● Mysqldump
-- Add-drop-table: add the droptable if exists statement when exporting SQL statements.
-- Quick export
-- Opt optimization option (recommended)
● Myisamchk
Checklist options
-- Extend-check extension check
-- Medium-check: a check option in the speed comparison.
Table repair options
-- Recover
-- Safe-recover: it is slower than -- recover to safely repair table files.
Modify and repair table items
-- Force clears the last temporary file
-- Quick can only be repaired based on the content of the reference file.
● Mysql management
You can use phpmyadmin (php environment support required) and mysqlcc (linux graphical interface support, WINDOWS system support

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.