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
Appear mysql> said landing success!
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 file:/usr/share/mysql (mysql.server command and configuration file)
Related commands:/usr/bin (mysqladmin, mysqldump, etc.) (*mysql a Safe Boot method:/usr/bin/mysqld_safe--user=root &)
Startup script:/etc/rc.d/init.d/
7. Stop/start MySQL service
[[email protected]/] #service MySQL stop;
[[email protected]/] #service MySQL start;
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 file my-medium.cnf under directory/usr/share/mysql 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 | MySQL target_db-uroot-pxxxxxx-h 221.218.9.41
MySQL installation, directory structure, configuration under Linux