MySQL Installation and use

Source: Internet
Author: User

Operating system: CentOS release 5.10 (Final)

File Preparation:

mysql-server-community-5.1.73-1.rhel5.i386.rpm

mysql-client-community-5.1.73-1.rhel5.i386.rpm

First, install MySQL

RPM Package Installation:

Switch to the directory where the package is located and execute:

Rpm-i mysql-server-community-5.1.73-1-I. mysql-client-community-5.1.73-1.rhel5.i386.rpm

After completion, MySQL's top-level installation directory is/ usr. Note that if you install only mysql-server, there is no such thing as MySQL, mysqladmin, etc. in these paths, and it is unusable.

/etc/init.d/MySQL/etc/logrotate.d/MySQL/etc/my.cnf/etc/mysqlmanager.passwd/usr/bin/Innochecksum/usr/bin/My_print_defaults/usr/bin/Myisam_ftdump/usr/bin/Myisamchk/usr/bin/Myisamlog/usr/bin/Myisampack/usr/bin/Mysql_convert_table_format/usr/bin/mysql_fix_extensions/usr/bin/Mysql_fix_privilege_tables/usr/bin/mysql_install_db/usr/bin/mysql_secure_installation/usr/bin/mysql_setpermission/usr/bin/Mysql_tzinfo_to_sql/usr/bin/Mysql_upgrade/usr/bin/Mysql_zap/usr/bin/Mysqlbug/usr/bin/Mysqld_multi/usr/bin/Mysqld_safe/usr/bin/Mysqldumpslow/usr/bin/mysqlhotcopy/usr/bin/mysqltest/usr/bin/perror/usr/bin/Replace/usr/bin/Resolve_stack_dump/usr/bin/Resolveip/usr/lib/mysql/mysqld-Debug.sym/usr/lib/mysql/Mysqld.sym/usr/lib/mysql/plugin/ha_innodb_plugin.so/usr/lib/mysql/plugin/ha_innodb_plugin.so.0/usr/lib/mysql/plugin/ha_innodb_plugin.so.0.0.0/usr/sbin/mysqld/usr/sbin/mysqld-Debug/usr/sbin/Mysqlmanager/usr/sbin/Rcmysql/usr/share/doc/mysql-server-community-5.1.73/usr/share/doc/mysql-server-community-5.1.73/COPYING/usr/share/doc/mysql-server-community-5.1.73/README/usr/share/doc/mysql-server-community-5.1.73/my-huge.cnf/usr/share/doc/mysql-server-community-5.1.73/my-innodb-heavy-4g.cnf/usr/share/doc/mysql-server-community-5.1.73/my-large.cnf/usr/share/doc/mysql-server-community-5.1.73/my-medium.cnf/usr/share/doc/mysql-server-community-5.1.73/my-small.cnf/usr/share/info/mysql.info.gz/usr/share/man/man1/innochecksum.1. GZ/usr/share/man/man1/my_print_defaults.1. GZ/usr/share/man/man1/myisam_ftdump.1. GZ/usr/share/man/man1/myisamchk.1. GZ/usr/share/man/man1/myisamlog.1. GZ/usr/share/man/man1/myisampack.1. GZ/usr/share/man/man1/mysql.server.1. GZ/usr/share/man/man1/mysql_convert_table_format.1. GZ/usr/share/man/man1/mysql_fix_extensions.1. GZ/usr/share/man/man1/mysql_fix_privilege_tables.1. GZ/usr/share/man/man1/mysql_install_db.1. GZ/usr/share/man/man1/mysql_secure_installation.1. GZ/usr/share/man/man1/mysql_setpermission.1. GZ/usr/share/man/man1/mysql_tzinfo_to_sql.1. GZ/usr/share/man/man1/mysql_upgrade.1. GZ/usr/share/man/man1/mysql_zap.1. GZ/usr/share/man/man1/mysqlbug.1. GZ/usr/share/man/man1/mysqld_multi.1. GZ/usr/share/man/man1/mysqld_safe.1. GZ/usr/share/man/man1/mysqldumpslow.1. GZ/usr/share/man/man1/mysqlhotcopy.1. GZ/usr/share/man/man1/mysqlman.1. GZ/usr/share/man/man1/mysqltest.1. GZ/usr/share/man/man1/perror.1. GZ/usr/share/man/man1/replace.1. GZ/usr/share/man/man1/resolve_stack_dump.1. GZ/usr/share/man/man1/resolveip.1. GZ/usr/share/man/man8/mysqld.8. GZ/usr/share/man/man8/mysqlmanager.8. GZ/usr/share/MySQL/usr/share/mysql/ChangeLog/usr/share/mysql/SELinux/usr/share/mysql/selinux/RHEL4/usr/share/mysql/selinux/rhel4/MYSQL.FC/usr/share/mysql/selinux/rhel4/Mysql.te/usr/share/mysql/binary-Configure/usr/share/mysql/charsets/usr/share/mysql/charsets/Index.xml/usr/share/mysql/charsets/README/usr/share/mysql/charsets/Armscii8.xml/usr/share/mysql/charsets/Ascii.xml/usr/share/mysql/charsets/Cp1250.xml/usr/share/mysql/charsets/Cp1251.xml/usr/share/mysql/charsets/Cp1256.xml/usr/share/mysql/charsets/Cp1257.xml/usr/share/mysql/charsets/Cp850.xml/usr/share/mysql/charsets/Cp852.xml/usr/share/mysql/charsets/Cp866.xml/usr/share/mysql/charsets/Dec8.xml/usr/share/mysql/charsets/Geostd8.xml/usr/share/mysql/charsets/Greek.xml/usr/share/mysql/charsets/Hebrew.xml/usr/share/mysql/charsets/Hp8.xml/usr/share/mysql/charsets/Keybcs2.xml/usr/share/mysql/charsets/Koi8r.xml/usr/share/mysql/charsets/Koi8u.xml/usr/share/mysql/charsets/Latin1.xml/usr/share/mysql/charsets/Latin2.xml/usr/share/mysql/charsets/Latin5.xml/usr/share/mysql/charsets/Latin7.xml/usr/share/mysql/charsets/Macce.xml/usr/share/mysql/charsets/Macroman.xml/usr/share/mysql/charsets/Swe7.xml/usr/share/mysql/Config.huge.ini/usr/share/mysql/Config.medium.ini/usr/share/mysql/Config.small.ini/usr/share/mysql/Czech/usr/share/mysql/czech/Errmsg.sys/usr/share/mysql/Danish/usr/share/mysql/danish/Errmsg.sys/usr/share/mysql/Dutch/usr/share/mysql/dutch/Errmsg.sys/usr/share/mysql/中文版/usr/share/mysql/english/Errmsg.sys/usr/share/mysql/Errmsg.txt/usr/share/mysql/Estonian/usr/share/mysql/estonian/Errmsg.sys/usr/share/mysql/Fill_help_tables.sql/usr/share/mysql/French/usr/share/mysql/french/Errmsg.sys/usr/share/mysql/German/usr/share/mysql/german/Errmsg.sys/usr/share/mysql/Greek/usr/share/mysql/greek/Errmsg.sys/usr/share/mysql/Hungarian/usr/share/mysql/hungarian/Errmsg.sys/usr/share/mysql/Italian/usr/share/mysql/italian/Errmsg.sys/usr/share/mysql/Japanese/usr/share/mysql/japanese/Errmsg.sys/usr/share/mysql/Korean/usr/share/mysql/korean/Errmsg.sys/usr/share/mysql/Mi_test_all/usr/share/mysql/Mi_test_all.res/usr/share/mysql/my-huge.cnf/usr/share/mysql/my-innodb-heavy-4g.cnf/usr/share/mysql/my-large.cnf/usr/share/mysql/my-medium.cnf/usr/share/mysql/my-small.cnf/usr/share/mysql/mysql-log-Rotate/usr/share/mysql/Mysql.server/usr/share/mysql/Mysql_fix_privilege_tables.sql/usr/share/mysql/Mysql_system_tables.sql/usr/share/mysql/Mysql_system_tables_data.sql/usr/share/mysql/Mysql_test_data_timezone.sql/usr/share/mysql/Mysqld_multi.server/usr/share/mysql/ndb-config-2-Node.ini/usr/share/mysql/Norwegian/usr/share/mysql/norwegian-NY/usr/share/mysql/norwegian-ny/Errmsg.sys/usr/share/mysql/norwegian/Errmsg.sys/usr/share/mysql/Polish/usr/share/mysql/polish/Errmsg.sys/usr/share/mysql/Portuguese/usr/share/mysql/portuguese/Errmsg.sys/usr/share/mysql/Romanian/usr/share/mysql/romanian/Errmsg.sys/usr/share/mysql/Russian/usr/share/mysql/russian/Errmsg.sys/usr/share/mysql/Serbian/usr/share/mysql/serbian/Errmsg.sys/usr/share/mysql/Slovak/usr/share/mysql/slovak/Errmsg.sys/usr/share/mysql/Spanish/usr/share/mysql/spanish/Errmsg.sys/usr/share/mysql/Swedish/usr/share/mysql/swedish/Errmsg.sys/usr/share/mysql/Ukrainian/usr/share/mysql/ukrainian/Errmsg.sys/usr/bin/Msql2mysql/usr/bin/MySQL/usr/bin/mysql_find_rows/usr/bin/Mysql_waitpid/usr/bin/mysqlaccess/usr/bin/mysqladmin/usr/bin/Mysqlbinlog/usr/bin/Mysqlcheck/usr/bin/mysqldump/usr/bin/Mysqlimport/usr/bin/Mysqlshow/usr/bin/Mysqlslap/usr/share/man/man1/msql2mysql.1. GZ/usr/share/man/man1/mysql.1. GZ/usr/share/man/man1/mysql_find_rows.1. GZ/usr/share/man/man1/mysql_waitpid.1. GZ/usr/share/man/man1/mysqlaccess.1. GZ/usr/share/man/man1/mysqladmin.1. GZ/usr/share/man/man1/mysqlbinlog.1. GZ/usr/share/man/man1/mysqlcheck.1. GZ/usr/share/man/man1/mysqldump.1. GZ/usr/share/man/man1/mysqlimport.1. GZ/usr/share/man/man1/mysqlshow.1. GZ/usr/share/man/man1/mysqlslap.1.gz
rpm-ql Mysql-server-community-5.1.73-1.rhel5 Mysql-client-community-5.1.73-1.rhel5

Second, the installation after the completion of the relevant configuration

① Run the MYSQL_INSTALL_DB program setting contains an initial MySQL authorization table that determines how users can connect to the server.

/usr/bin/mysql_install_db--user=root

The mysql_install_db script creates a data directory, a MySQL database with all database permissions, and a test database that can be used for testing MySQL. The script creates an authorization table entry for the root account and the anonymous user account.

② start the database.

/usr/bin/mysqld_safe--user=mysql &

③ Configuration Database

Set a password for the database (initially empty):

/usr/bin/mysqladmin-u root password ' new-password '

Remove the test database:

/usr/bin/mysqladmin-u Root Drop test

The above two actions can be replaced by the Mysql_secure_installation script:

/usr/bin/mysql_secure_installation

Its features include:

Change the root password?

Remove anonymous users?

Disallow Root login remotely?

Remove test database and access to it?

Reload privilege tables now?

④ shutting down the database

/etc/init.d/MySQL stop or mysqadmin shutdown-uroot-p

⑤ Start the database automatically
If the/etc/init.d/mysql exists or is valid in ④, the database is most likely started automatically and is confirmed in the following ways:

[[Email protected] ~] # chkconfig--list | grep mysqlmysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off

If you can list the startup status of MySQL, and at least 3 and 4 are on, then MySQL can start automatically. If not, then configure:

cd/usr/share/mysql//etc/init.d/+x/etc/init.d/mysql

Chkconfig--addmysql

Chkconfig--level 345MySQL on

problems that you may experience when you configure the auto-start database :

When performing

/etc/init.d/mysql

Appears when

Starting mysql.manager of PID-file quit without updating file [Failed]

Query log:

Have errors

/usr/sbin/mysqld:file './mysql-bin.index ' not Found (errcode:13)
140507 21:38:01 [ERROR] Aborting

And then, execute

/etc/init.d/mysql--user=root

With the parameter user is no problem (--user=root or--user=mysql)

Workaround:

Chgrp-r mysql/var/lib/mysql/-R mysql/var/lib/mysql/  

/var/lib/mysql/is the folder where Mysql-bin.index resides.

References and Links:

MySQL5.1 Reference Manual: Http://dev.mysql.com/doc/refman/5.1/zh/index.html

Mysql5.1:http://dev.mysql.com/downloads/mysql/5.1.html#downloads

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.