MySQL-encoded Linux platform

Source: Internet
Author: User

Install MySQL5.0.37 in Linux using the following three packages:
MySQL-client-community-5.0.37-0.rhel3.i386.rpm
MySQL-server-community-5.0.37-0.rhel3.i386.rpm
Perl-DBI-1.53-2.fc7.i386.rpm
(The following steps require root permissions)
1. Verify that MySQL has been installed
Rpm-qa | grep MySQL
If you have installed and need to uninstall it, run the following command:
Rpm-e MySQL-client-community MySQL-server-community
2. Installation
Run: rpm-ivh MySQL-client-community-5.0.37-0.rhel3.i386.rpm MySQL-server-community-5.0.37-0.rhel3.i386.rpm
If the console prompts:
Error: Failed dependencies:
Perl (DBI) is needed by MySQL-client-community-5.0.37-0.rhel3.i386
Perl (DBI) is needed by MySQL-server-community-5.0.37-0.rhel3.i386
Indicates that the DBI module is missing in the current operating system. Install the DBI module first.
Rpm-ivh perl-DBI-1.53-2.fc7.i386.rpm
The following text indicates that the installation is correct:
Preparing... ######################################## ### [100%]
1: perl-DBI ##################################### ###### [100%]
Run the MySQL installation command again.
The following text indicates that the installation is correct:
Preparing... ######################################## ### [100%]
1: mySQL-server-community ################################### ####### [1, 50%]
2: mySQL-client-community ################################### ####### [1, 100%]
3. initialize Installation
/Usr/bin/mysql_install_db
4. Start mysql
/Etc/init. d/mysql start
(There are two methods to stop: [mysqladmin-uroot-p shutdown] [/etc/init. d/mysql stop])
5. Verify that the installation is successful.
Netstat-nat | grep 3306
If you can see the following line, the installation is normal:
Tcp 0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN
6. Modify the mysql root User Password
Mysqladmin-u root password '123'
7. log on to the mysql client
Mysql-uroot-p
Input: 123456
8. Create a database
Mysql> create database gbkdb character set gbk;
Query OK, 1 row affected (0.01 sec)
9. Create a user for the database gbkdb (user: user Password: 123)
Mysql> grant select, insert, update, delete, create on gbkdb. * to user @ "%" identified by "123 ";
Query OK, 0 rows affected (0.01 sec) 10. modify the configuration
Cp/usr/share/mysql/my-medium.cnf/etc/my. cnf
Vi/etc/my. cnf
Add a line under [client:
[Client]
Default-character-set = gbk
Add three lines under [mysqld:
[Mysqld]
Default-character-set = gbk
Default-collation = gbk_chinese_ci
Init_connect = 'set NAMES gbk'
Add a line under [mysql:
[Mysql]
Default-character-set = gbk
11. Restart MySQL
/Etc/init. d/mysql restart
12. log on to the mysql console again to confirm configuration changes.
Mysql-uroot-p
Input: 123456
Mysql> show variables like 'character _ set _ % ';
+ -------------------------- + ---------------------------- +
| Variable_name | Value |
+ -------------------------- + ---------------------------- +
| Character_set_client | gbk |
| Character_set_connection | gbk |
| Character_set_database | gbk |
| Character_set_filesystem | binary |
| Character_set_results | gbk |
| Character_set_server | gbk |
| Character_set_system | utf8 |
| Character_sets_dir |/usr/share/mysql/charsets/|
+ -------------------------- + ---------------------------- +
13. log on to the remote console and confirm that you can use
Mysql-h10.10.1.156-uuser-p
Input: 123
Mysql> use gbkdb;
Database changed

  • 1
  • 2
  • Next Page

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.