1.centOS installing MySQL

Source: Internet
Author: User
Tags mysql client mysql update install perl iptables percona percona server

Last week, I studied MySQL for one weeks, and from now on I have learned something.

----------------------------------------------

MySQL installation I have tried two kinds of installation, a RPM way, a green way to install, personal feel the most convenient rpm mode

1.rpm mode

1) Required Packages: (5.5 For example, https://dev.mysql.com/downloads/mysql/5.5.html#downloads)

mysql-client-5.5.48-1.linux2.6.i386.rpm

mysql-server-5.5.48-1.linux2.6.i386.rpm

2) Check if MySQL is installed on the machine

Rpm-qa|grep-i MySQL

If no input has been installed, uninstall it with the RPM-E package name if the installation needs to be uninstalled.

3) Install the server, red box means: MySQL default created a root user, but no password, you need to later specify

    

4) Install the client

    

5) Check if the installation is successful. The MySQL installation process will automatically create a MySQL user and user group for you to see if it was created, which is also to check whether the installation was successful, or to perform a mysqladmin--version command check for success

    

6) MySQL start and stop. MySQL command is registered as a service during MySQL installation, so it can be started and stopped through service mode.

    

7) connection

The first time you connect, no password is required. MySQL command default root user, default native IP, default 3306 port, and the root user does not have the default password, so is connected to the

    

Set a password for root

    

8) set boot up MySQL

More/etc/inittab Check the system default boot level, mine is 3

So use chkconfig--level 3 mysql on to set boot up

9) Modify the configuration file location to etc below

    

10) Modifying the character set

Check the character set first: show variables like ' character% '; See that the default character set used is Latin1

    

Modify the My.cnf file

[Client]

Default-character-set = UTF8

[MySQL]

Default-character-set = UTF8

[Mysqld]

Character_set_server=utf8
Character_set_client=utf8
Collation-server=utf8_general_ci

init_connect= ' SET NAMES UTF8 '

Save and restart MySQL.

11) Other optional configurations

You can set the storage directory for the data files in MY.CNF:

DataDir =/var/lib/mysql/

2. Green Installation Method

  1) required packages, take Percona5.5 as an example percona-server-5.5.30-rel30.2-500.linux.x86_64.tar.gz    percona-server-client-55-5.5.35-rel33.0.611.rhel6.x86_64.rpm    PERCONA-SERVER-SHARED-55-5.5.35-REL33.0.611.RHEL6.X86_64.RPM 2) Decompression, recommended decompression to the/usr/local/mysql/directory percona-server-5.5.30-rel30.2-500.linux.x86_64.tar.gz to/usr/local/mysql/directory 3. View Dependencies Ldd/usr/local/mysql/bin/mysqld & nbsp   My report The following information Linux-vdso.so.1 =>  (0x00007fff783ff000)         libpthread.so.0 =/li b64/libpthread.so.0 (0x00007facd19bb000)         libaio.so.1 =/lib64/libaio.so.1 (0x0000003548     a00000)         libm.so.6 =/lib64/libm.so.6 (0x00007facd1736000)         Librt.so.1 =/lib64/librt.so.1 (0x00007facd152e000)         libcrypt.so.1 =/lib64/libcry Pt.so.1 (0x00007facd12f7000)         libdl.so.2 =/lib64/libdl.so.2 (0x00007facd10f2000)            Libssl.so.6 = not found        libcrypto.so.6 = not found        libc.so.6 =/lib64/libc.so.6 (0x00007facd0d5d000)        /lib64/ld-linux-x86-64.so.2 (0x0000 7facd1be5000)         libfreebl3.so =/lib64/libfreebl3.so (0x00007facd0b5a000) 4. Install the missing dependencies and then do the soft Connect yum-y Install libssl.so.6 find the appropriate file by installing the Find/-name "libssl.so*". Then do a soft connect  ln-s/usr/lib64/libssl.so.1.0.1e/lib64/libssl.so.6 Find/-name "libcrypto.so*" to locate the appropriate file. Then do the soft connect ln-s/usr/lib64/libcrypto.so.1.0.1e/lib64/libcrypto.so.6  5. Create MySQL user groups and users in CentOS, this user can actually not login this function, So setting the-s/sbin/nologin parameter,-m means not creating the user directory Groupadd MySQL useradd mysql-g mysql-m-s/sbin/nologin  6. Performing Installation/usr/local/m ysql/scripts/mysql_install_db--basedir=/usr/local/mysql --datadir=/var/lib/mysql--user=mysql  7. Add to System service cp/usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld  8. StartDynamic Chkconfig--add mysqld  9. Replace or modify/etc/my.conf   10. Start service Services mysqld start PS: If my.conf is not configured Basedir  Report: [[email protected] ~]# service mysqld start/etc/init.d/mysqld:line 256:my_print_defaults:command not found /etc/init.d/mysqld:line 276:CD:/usr/local/percona-server-5.5.30-rel30.2-500.linux.x86_64:no such file or directory S tarting MySQL (Percona server) couldn ' t find MySQL server ([failed]ocal/percona-server-5.5.30-rel30.2-500.linux.x86_64/bin /mysqld_safe)   11. No password required for first login.  After successful login, change the root password and turn on root telnet use MySQL update user set Password=password (' 123456 ') where user= ' root ';  Grant all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT option;  Flush privileges; Re-login   PS: If you are prompted without MySQL command when logging in, you need to install MySQL client installation RPM-IVH percona-server-shared-55-5.5.35-rel33.0.611.rhel6.x86_64.rpm RPM-IVH percona-server-client-55-5.5.35-rel33.0.611.rhel6.x86_64.rpm  PS: If you report this error when installing error:failed dependencies:/usr/ Bin/perl is NeedeD by mysql-server-5.5.28-1.linux2.6.i386 install yum -y install perl  12) firewall add MySQL port vim/etc/sysconfig/iptables Service Iptables Restart

1.centOS installing MySQL

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.