Install mysql-SuSE Linux Enterprise Server SP3

Source: Internet
Author: User

1. Preparatory work
Download the MySQL server-side-client package from the MySQL official web separately:

mysql-server-5.5.49-1.sles11.x86.rpm

mysql-client-5.5.49-1.sles11.x86_64.rpm

2, the detection system is installed MySQL

#rpm-qa | Grep-i MySQL
If it has been installed, it will appear:
Mysql-server-5.0.22-0.i386
Mysql-client-5.0.22-0.i386
Then enter the following command to delete it:
#rpm-ev mysql-server-5.0.22-0.i386
# Rpm-ev Mysql-client-5.0.22-0.i386
Note: If deletion occurs, the deletion is unsuccessful and the dependent package appears, assuming that the dependency must be removed. Rpm-ev dovecot-1.0.7-7.el5.x86_64 3. Install MySQL
# RPM-IVH mysql-server-5.5.49-1.sles11.x86.rpm
# RPM-IVH mysql-client-5.5.49-1.sles11.x86_64.rpm 4, first understand the default installation location and role
1. Database Directory/var/lib/mysql/
2. Configuration file/usr/share/mysql (mysql.server command and configuration file)
3. Related command/usr/bin (mysqladmin mysqldump, etc.)
4. Startup script/etc/rc.d/init.d/(startup script file MySQL directory) such as:/etc/rc.d/init.d/mysql Start/restart/stop/status
Special Note:The boot script directory for SuSE Linux is in the/ETC/INIT.D directory, and after the MySQL installation is complete, it will be missing the Mysql.sock socket file, so you must go to this directory to start MySQL 5. Migrating the database directory
Because the MySQL database directory occupies a large disk, so I built a directory in the/root directory data, the command is as follows:
# CD/
# mkdir Data
# chmod 755 Data
Move the database to the data directory. Enter the following command:
# Mv/var/lib/mysql/data
Finally, enter the data directory and you will see a MySQL folder.
After the copy also need to modify the/etc/init.d/mysql DataDir directory value, the result is as follows: basedir=
Datadir=/data/mysql 6. write config fileCopy the configuration file to/etc directory and name it MY.CNF (must be named MY.CNF)
#cp/usr/share/mysql/my-medium.cnf/etc/my.cnf
Edit MY.CNF:[Client]
Password = 123456
Port = 3306
socket =/data/mysql/mysql.sock
Default-character-set=utf8
[Mysqld]
Port = 3306
socket =/data/mysql/mysql.sock
Skip-external-locking
Key_buffer_size = 16M
Max_allowed_packet = 1M
Table_open_cache = 64
Sort_buffer_size = 512K
Net_buffer_length = 8K
Read_buffer_size = 256K
Read_rnd_buffer_size = 512K
Myisam_sort_buffer_size = 8M
Character_set_server=utf8
Collation-server=utf8_general_ci
Lower_case_table_names=1
Character_set_client=utf8
max_connections=1000
[MySQL]
default-character-set = UTF8
No-auto-rehash 7. Restart MySQL Service
# cd/usr/bin# mysql_install_db
# CD/ETC/INIT.D
#./mysql Restart 8. Log in to MySQL
# Cd/usr/bin
# mysql-u Root-p
Enterpassword: (direct enter, because the first time is a blank password)
After successful login, change password
Mysql> show databases;mysql> use MySQL;
Mysql> Show tables;
mysql> Update user Set Password=password (' 123456 ') where user= ' root ';
Finally restart MySQL, password effective
#/usr/local/mysql/bin/mysqld_safe--user=mysql &
# CD/ETC/INIT.D
#./mysql Restart 9. Open the firewall
# VI/ETC/SYSCONFIG/SUSEFIREWALL2
fw_services_ext_tcp= "22 5901 803306"
After ESC: Wq save exit
To restart the firewall:
# rcSuSEfirewall2 Restart
Check to see if the MySQL service is started:
# Netstat-nat | grep 3306
Check that the UTF8 encoding of the setting is in effect:
Mysql> Show variables like '%colla% ';
Mysql> Show variables like '%char% '; 10. Set up remote access:
# Cd/usr/bin
# mysql-u Root-p (or mysql-u root-p-h 127.0.0.1)
mysql> use MySQL; Mysql> Grant all privileges on * * to [email protected] ' My IP ' identified by ' password ';
Mysql> select Host,user from user;
mysql> FLUSH privileges; 11, MySQL set self-start
Chkconfig MySQL on
This is not necessarily successful because there are no sockets. 12. mysql Export Import
mysql> mysqldump ABC (database name)--user=root--password >/root/abc.sql #导出整个库
Mysql> mysqldump-u root-p ABC (database name) User (table name) >/user.sql #导出单张表
Note that if you run mysqldump without specifying the--quick or--opt option, the entire result set is placed in memory. Problems may occur if you export a large database
Import:
Mysql> CREATE DATABASE ABC;
mysql> use ABC;
Mysql> Source/root/abc.sql #导入数据库
Mysql> Source/user.sql #导入单张表

Reprinted from: http://xinchibaobei.blog.163.com/blog/static/12639250920134954835786/

Install mysql-SuSE Linux Enterprise Server SP3

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.