1. Modify/ETC/MY.CNF before installation, add DataDir =/data/mysql/and then execute sed-i ' s/skip-locking/skip-external-locking/g '/etc/my.cnf command , change the contents of the directory to your new directory
2. After installation
Stop MySQL, move/usr/local/mysql/var/to new directory, modify/ETC/MY.CNF, find [mysqld], add datadir =/data/mysql/below, add permissions to the new directory, reboot.
Note that the data is backed up before the change!!!!
I was installed after modifying/etc/my.cnf appeared mysql:starting MySQL ..... error! The server quit without updating PID file
The following method is equivalent to reinstalling MySQL, the data is gone.
1 questions
[Email protected] mysql]#/etc/rc.d/init.d/mysql status
MySQL is isn't running, but lock file (/var/lock/subsys/mysql[failed]
[[email protected] mysql]#/etc/rc.d/init.d/mysql start
Starting MySQL ... The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid). [FAILED]
2 reasons
No permission table initialized
3 Solutions
#cd/usr/local/mysql (go to MySQL installation directory)
#chown-R mysql.mysql.
#su-mysql
$CD Server
$scripts/mysql_install_db
4 I solve the process
[Email protected] ~]# cd/usr/local/mysql
[Email protected] mysql]# chown-r mysql.mysql.
[Email protected] mysql]# su-mysql
[Email protected] ~]$ cd/usr/local/mysql
[Email protected] mysql]$ scripts/mysql_install_db
Installing MySQL system tables ...
Ok
Filling Help Tables ...
Ok
To start mysqld at boot time with to copy
Support-files/mysql.server to the right place for your system
REMEMBER to SET A PASSWORD for the MySQL root USER!
To does so, start the server, then issue the following commands:
./bin/mysqladmin-u root password ' new-password '
./bin/mysqladmin-u root-h localhost.localdomain password ' new-password '
Alternatively you can run:
./bin/mysql_secure_installation
Which would also give you the option of removing the test
Databases and anonymous user created by default. This is
Strongly recommended for production servers.
See the Manual for more instructions.
You can start the MySQL daemon with:
Cd. ;./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
CD./mysql-test; Perl mysql-test-run.pl
Problems with the./bin/mysqlbug script!
[Email protected] mysql]$/usr/local/mysql/bin/mysqld_safe--user=mysql &
[1] 11767
[Email protected] mysql]$ 120502 07:01:17 mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err '.
120502 07:01:17 Mysqld_safe starting mysqld daemon with databases From/usr/local/mysql/data
[Email protected] mysql]$/etc/rc.d/init.d/mysql Status
MySQL running (11830) [OK]
[Email protected] mysql]$/etc/rc.d/init.d/mysql Start
Starting MySQL [OK]
After successful, change the database password
Password to modify the MySQL user (root) under Linux
The modified users are listed as root.
first, the root of the original myql password;
Method One:
Outside the MySQL system, use the Mysqladmin
#mysqladmin-u root-p Password "test123"
Enter Password: "Enter the original password"
Method Two:
By logging into the MySQL system,
#mysql-uroot-p
Enter Password: "Enter the original password"
Mysql>Use MySQL;
Mysql>Update user Set Password=password ("test") where user= ' root ';
Mysql>flush Privileges;
Mysql>exit;
Second, forget the original myql root password;
First, you must have root access to the operating system. If you do not have the root authority of the system, consider the root system before taking the following steps.
Similar to the Safe Mode login system, it was suggested thatpkill MySQL, but I'm not suggesting that ha. Because when you execute this command, it can result in a situation like this:
/ETC/INIT.D/MYSQLD status
Mysqld dead but Subsys locked
This may not be useful even if you are starting MySQL in safe mode, so this is usually the case/etc/init.d/mysqld Stop, if you unfortunately first use the Pkill, then start a bit more stop.
#mysqld_safe--skip-grant-tables &
&, that means running in the background, no longer running in the background, then open a terminal.
#MySQL
Mysql>Use MySQL;
Mysql>UPDATE user SET Password=password ("test123") WHERE user= ' root ';
Mysql>flush Privileges;
Mysql>exit;
# #本来mysql是不分大小写的, but this is the specific value of MySQL database that is modified in MySQL, to be noted.
lnmp1.1 transfer MySQL database problem mysql:starting mysql ..... error! The server quit without updating PID file