Summary of Mysql usage in Linux

Source: Internet
Author: User
1. mysql service mysqld: unrecognizedservice solution yuminstallmysql-server2, error: java. SQL. SQLException: null, messagefromserver: solution GRANTALLPRIVILEGESON *.*

1. mysql service mysqld: unrecognized service cannot be found. Solution: yum install mysql-server 2. Error: java. SQL. SQLException: null, message from server: Host 's1pa124' is not allowed to connect to this MySQL server solution grant all privileges on *. *

1. mysql service not found

mysqld: unrecognized service
yum install mysql-server
2. Error: java. SQL. SQLException: null, message from server: "Host 's1pa124' is not allowed to connect to this MySQL server"



3. Modify the mysql password

#/Etc/init. d/mysql stop # mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking & # mysql-u root mysqlmysql> UPDATE user SET Password = PASSWORD ('newpassword ') where USER = 'root'; mysql> flush privileges; mysql> quit #/etc/init. d/mysql restart # mysql-uroot-pEnter password:
4. mysql needs to install the following services:
yum install mysql yum install mysql-server yum install mysql-devel

5. the default password for Mysql installation is blank.

[Root @ fk01 ~] # Mysql-uroot-p // press enter and then press ENTER


6. Modify mysql dataDir

(1) stop mysql: service mysqld stop

(2) create a data directory for Migration: mkdir-p/app/mysql/data

(3) Move the default mysql data DIRECTORY to the new directory: mv/var/lib/mysql/app/mysql/data

(4) create a soft link: ln-s/app/mysql/data/mysql/var/lib/mysql

(5) modify the permissions of the/app/mysql directory to the mysql user: chown-R/app/mysql.

(6) Start mysql service: service mysqld restart

(7) Summary of errors:

[root@fk01 var]# service mysqld restartStopping MySQL:  [FAILED]Timeout error occurred trying to start MySQL Daemon.Starting MySQL:  [FAILED]
View mysql logs

[root@fk01 log]# tail -200 mysqld.log150304 14:13:40  mysqld started150304 14:13:40  InnoDB: Operating system error number 13 in a file operation.InnoDB: The error means mysqld does not have the access rights toInnoDB: the directory.InnoDB: File name ./ibdata1InnoDB: File operation call: 'open'.InnoDB: Cannot continue operation.150304 14:13:40  mysqld ended
We can see from the above that the permission is related to the mysql user. Solution: chown-R/app/mysql

7. Copy the mysql database to another machine.

Source database name: source_db Username: root Password: 123456
Target Database Name: target_db Username: root Password: 123456 HOST:

Access Permissions authorized to the source machine in the target database

grant all privileges on target_db.* to root@  identified by '123456';

Run the command in the data directory of the source database.

mysqldump source_db -uroot -p123456 --opt | mysql target_db -uroot -p123456 -h

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: 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.