MySQL installation, directory structure, configuration under Linux

Source: Internet
Author: User

1, ready to install the program (official website download)

Service side:MySQL-server-community-5.1.44-1.rhel4.i386.rpm

Client:MySQL-client-community-5.1.44-1.rhel4.i386.rpm

2, installation (printing information slightly)

[[email protected]/] #rpm-IVH MySQL-server-community-5.1.44-1.rhel4.i386.rpm;

[[email protected]/] #rpm-IVH MySQL-client-community-5.1.44-1.rhel4.i386.rpm;

3. See if the installation was successful

[[email protected]/] #netstat-NTPL;

Display 3306 port open indicates successful installation of service

4. Test connection

(* Change root password)

[Email protected]/]#/usr/bin/mysqladmin-u root password ' xxxxxx ';

[Email protected]/]# MySQL-U root-p

Enter password:xxxxxx

The mysql> Show login is successful!

5. Set remote access permissions for MySQL users

Method 1, change the table method: After landing MySQL , the "MySQL" database in the "User" table "host" item, "localhost" to change "%"

MySQL>use MySQL;

MySQL>update User Set host = '% ' where user = ' root ';

MySQL>select host,user from user;

MySQL>flush Privileges

Method 2, Authorization law: Assume that the user is allowed to username from a remote connection to the MySQL server via password password

MySQL>grant all rrivileges on * * to [e-mail protected] '% ' identified by ' password ' with GRANT OPTION;

MySQL>flush privileges;

6. Installation directory structure

Database directory :/var/lib/mysql/

Configuration files:/usr/share/mysql(mysql. server command and configuration file)

Related commands:/usr/bin (Mysqladmin, mysqldump and other commands) (* A secure boot mode formysql :/usr/bin/mysqld_safe--user=root &)

Startup script:/etc/rc.d/init.d/

7. Stop/start MySQL service

[[email protected]/] #service MySQLStop

[[email protected]/] #service MySQLStart

8. Modify character encoding

To view character encodings:

[[email protected]/] #show variables like ' character\_set\_% ';

[[email protected]/] #show variables like ' collation_% ';

Stop MySQL service

Copy the directory /usr/share/file my-medium.cnf underMySQL to/etc/and rename it to MY.CNF

Open my.cnf Add Default-character-set=utf8 under [client] and [mysqld], and save

*MySQL5.5 changed the character set parameter Character-set-server=utf8

Restart MySQL service

9. Uninstall MySQL

[[email protected]/] #rpm-qa|grep-i MySQL

Show:

MySQL-server-community-5.1.44-1.rhel4.i386.rpm

MySQL-client-community-5.1.44-1.rhel4.i386.rpm

[[email protected]/] #rpm-E MySQL-server-community-5.1.44-1.rhel4.i386.rpm

[[email protected]/] #rpm-E MySQL-client-community-5.1.44-1.rhel4.i386.rpm

Delete residual files

[[email protected]/] #rm-F/ETC/MY.CNF

[[email protected]/] #rm-F/var/lib/ MySQL

10. Copy MySQL database

Source database name: source_db user name: root password: xxxxxx

Target database name:target_db user name:root Password:xxxxxx Host:221.218.9.41

Shell>mysqldump source_db-uroot-pxxxxxx--opt | MySQLTarget_db-uroot-pxxxxxx-h 221.218.9.41

MySQL installation, directory structure, configuration under Linux

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.