Mysql configuration in CentOS

Source: Internet
Author: User

Mysql configuration in CentOS
Install rmp-ivh MySQL-server-4.1.22-0.glibc23.i386.rpm -- nodepsrmp-ivhMySQL-client-4.1.22-0.glibc23.i386.rpm -- nodeps check if the installation is successful netstat-atln command to see port 3306 open instructions installation successful login mysql [-u username] [-h host] [- p [password] [dbname] no password at first, this mysql executable file is in the/usr/bin/mysql directory 1, database directory/var/lib/mysql/2, configuration file/usr/share/mysql (mysql. server commands and configuration files) 3. Related commands/usr/bin (mysqladmin mysqldump and other commands) 4. STARTUP script/etc/rc. d/init. d/(directory of the mysql STARTUP script file) change the login password MySQL Default no password usr/bin/mysqladmin-u root password 'new-password' format: mysqladmin-u username-p old password new password Start and Stop MySQL after installation is complete start file mysql at/etc/init. run the following command to start the Directory d:/etc/init. d/mysql start stop:/usr/bin/mysqladmin-u root-p shutdown

Restart:

Sudo/etc/init. d/mysqlrestart

Automatic Start: check whether mysql is in the Automatic startup list/sbin/chkconfig -- list add MySQL to your system startup Service Group/sbin/chkconfig -- add mysql to delete MySQL from the startup Service Group/ sbin/chkconfig -- del mysql configuration copy/usr/share/mysql/my-medium.cnf to/etc/my. cnf. modify my later. cnf file to modify the global settings of mysql. set innodb_flush_log_at_trx_commit In the cnf file to 0 for optimization.

Add lower_case_table_names to [mysqld] and set it to 1, without case sensitivity.

Set the default encoding of the character set MySQL to Latin1, which does not support Chinese characters. To support it, you must change the default encoding of the database to gbk or utf8. 1. Stop MySQL Service (bin/mysqladmin-u root shutdown) 2. Find my under/etc. cnf, if not, copy the my-medium.cnf under the support-files directory under the MySQL installation directory to/etc/and rename it to my. cnf. 3. Open my. after cnf, add default-character-set = utf8 under [client] and [mysqld] to save and disable it. 4. Start the MySQL Service (bin/mysqld_safe &) to query the character set: show variables like '% set %'; added MySQL user format: grant select on database. * to username @ login host identified by "password" grant select, insert, update, delete on *. * to user_1 @ '%' Identified by '1 23 '; grant all on *. * to user_1 @ 'localhost' Identified by '2013'; Remote Access: grant all privileges on *. * TO xoops_root @ '%' identified by '000000'; allows the xoops_root user TO log on TO MySQL from any machine. 2. edit/etc/mysql/my. cnf> skip-networking => # skip-networking to allow other machines to access MySQL.

Grant all on *. * to 'root' @ 'IP' identified by 'Password ';

Back up and recover the backup to the database directory. Run cd/val/lib/mysqlmysqldump-u root-p -- opt aaa> back_aaa to restore mysql-u root-p ccc <back_aaa

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.