Zero-based MySQL---mysql Installation and environment deployment

Source: Internet
Author: User
Tags mirror website

Official website:Dev.mysql.com/downloads MySQL version used in the current lab environment:Mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz commands for direct wget under Linux:wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz Domestic Mirror website:http://mirrors.sohu.com/ install MySQL: 1. Unzip:Mkdir-p/data/mysql tar zxvf/mnt/mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz ln-s/mnt/mysql-5.6.29-linux-g Libc2.5-x86_64/usr/local/mysql cd/usr/local/mysql CP SUPPORT-FILES/MYSQL.SERVER/ETC/INIT.D 2. Create a user group:Groupadd MySQL useradd-g mysql-m-s/sbin/nologin MySQL 3. Change the environment variables:echo $PATH vim/etc/profile echo "Export path= $PATH:/usr/local/mysql/bin" >>/etc/profile source /etc/profile 4. Create the required directory and change the permissions:Mkdir/data/mysql/mysql3306/{data,tmp,logs} chown-r mysql:mysql/data/mysql/mysql3306/chown-r Mysql:mysql /opt/mysql Chown-r Mysql:mysql/usr/local/mysql 5. Create the configuration file and change the configuration file:%S/3306/3316/G change socket On demand =/tmp/mysql3376.sock Innodb_date_file_path = ibdata1:100m:autoextend 6. Initialize:Cd/usr/local/mysql./scripts/mysql_install_db--defaults-file=/etc/my.cnf See two times OK 7. Start:/etc/init.d/mysql Start | | Service MySQL Start 8. Security hardening only after initialization is complete:1). After installing Mysql-server, you will be prompted to run mysql_secure_installation. Running Mysql_secure_installation will perform several settings:
A) set a password for the root user
b) Delete Anonymous account
c) Remove the root user from remote login
d) Delete the test library and access to the test library
e) Refresh the authorization form to make the change effective 2). Select User,host,password from Mysql.user;            Delete from Mysql.user where user! = ' root ' ot host! = ' localhost ';            TRUNCATE TABLE mysql.db drop database test; Flush privileges; 9. Turn off MySQL/usr/local/mysql/bin/mysqladmin-s/tmp/mysql3376.sock Shutdown SS-TNL | grep 3306 Sock is a communication mode listener for UNIX domain the mistakes and solutions I encountered:[[email protected]mysql]# ./scripts/mysql_install_db--defaults-file=/data/mysql/mysql3376/my3376.cnfWarning:the host ' mysqldb15 ' could not being looked up with/usr/local/mysql/bin/resolveip. This probably means that your libc libraries is not the Compatiblewith this binary MySQL version. The MySQL daemon, mysqld, should worknormally with the exception that host name resolving won't work. This means the should use IP addresses instead of Hostnameswhen specifying MySQL privileges! This error should be in/etc/hosts there is no resolution, workaround: vi/etc/hosts 192.168.6.15 mysqldb15Installing MySQL system tables ... 2016-03-31 14:50:18 0 [Warning] TIMESTAMP with implicit the DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-03-31 14:50:18 0 [not E]./bin/mysqld (mysqld 5.6.29-log) starting as Process 6160 ... missing Explicit_defaults_for_timestamp parameter, plus you can [Email protected]localhost]# tail-f error3376.log2016-03-31 15:00:16 6265 [note] innodb: using atomics to ref  Count buffer pool pages2016-03-31 15:00:16 6265 [note] innodb: the  InnoDB memory heap is disabled2016-03-31 15:00:16 6265 [Note]  innodb: mutexes and rw_locks use gcc atomic builtins2016-03-31  15:00:16 6265 [note] innodb: memory barrier is not used2016-03-31  15:00:16 6265 [Note] InnoDB: Compressed tables use zlib  1.2.32016-03-31 15:00:16 6265 [note] innodb: using linux native  aio2016-03-31 15:00:16 6265 [note] innodb: not using cpu crc32  instructions2016-03-31 15:00:16 6265 [note] innodb: initializing buffer  POOL,&NBSP;SIZE&NBSP;=&NBSP;1.0G2016-03-31&NBSP;15:00:16 6265 [note] innodb: completed initialization of buffer  pool2016-03-31 15:00:16 6265 [note] innodb: restoring page 0 of  Tablespace 02016-03-31 15:00:16 6265 [warning] innodb: doublewrite does  not have page_no=0 of space: 02016-03-31 15:00:16 6265 [error]  innodb: space header page consists of zero bytes in data  file ./ibdata12016-03-31 15:00:16 6265 [error] innodb: could not  open or create the system tablespace. If you tried to  Add new data files to the system tablespace, and it failed  here, you should now edit innodb_data_file_path in my.cnf back  to what it was, and remove the new ibdata files innodb created in this  Failed attempt. innodb only wrote those files full of zeros,  but did not yet use them in any way. But be  careful: do not remove old data files which contain your  precious data!2016-03-31 15:00:16 6265 [error] plugin  ' InnoDB '  init  function returned error.2016-03-31 15:00:16 6265 [error] plugin  ' InnoDB '  registration as a storage engine failed.2016-03-31 15:00:16 6265  [error] unknown/unsupported storage engine: innodb2016-03-31 15:00:16 6265  [ERROR] Aborting2016-03-31 15:00:16 6265 [Note] Binlog end2016-03-31  15:00:16 6265 [note]&nbsP;. /bin/mysqld: shutdown complete  Delete data below, reinitialize   start && log in: /usr/local/mysql/bin/mysqld--defaults-file=/data/mysql/mysql3306/my3306.cnf & Mysql-uroot-p-s/tmp/mysql3306. Sock To set the root password:mysqladmin-u root password ' 123 ' orMysql>set password for ' root ' @ ' localhost ' =password (' 123 '); Mysql>flush privileges; To create a shutdown User:Grant Shutdown on * * to [email protected] ' localhost ' identified by ' 1234 ';            Flush privileges; Mysqladmin-s/tmp/mysql3306.sock shutdown--user=amin--password=1234 orMysqladmin-s/tmp/mysql3306.sock shutdown--user=amin-p1234 set boot up, according to your needs: echo "/usr/local/mysql/bin/mysqld--defaults-file=/data/mysql/mysql3306/my3306.cnf &" > >/etc/rc.local each time the command is too cumbersome, we can write the startup shutdown as a related script:Set startup script:/usr/local/mysql/bin/mysqld--DEFAULTS-FILE=/DATA/MYSQL/MYSQL3306/MY3306.CNF & Set Shutdown script: Mysqladmin-s/tmp /mysql3306.sock shutdown--user=root--password=123 Set Restart script: Mysqladmin-s/tmp/mysql3306.sock shutdown--user=root-- Password=123/usr/local/mysql/bin/mysqld--DEFAULTS-FILE=/DATA/MYSQL/MYSQL3306/MY3306.CNF & Import Data: Mysql-uroot-p-s/tmp/mysql3306.sock < Backup.sql

Zero-based MySQL---mysql Installation and environment deployment

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.