MySQL data file is moved to/home/data/MySQL.
4. Find the my. CNF configuration file.If my. for the CNF configuration file, go to/usr/share/MySQL/and find *. copy one of the CNF files to/etc/and change it to my. CNF. The command is as follows:[Root @ test1 MySQL] # cp/usr/share/MyS
Mysql is installed in linux today, but Can't connect to local MySQL server through socket '/var/lib/mysql appears during connection. sock prompts. Below I will summarize some solutions and some parameter documents for Baidu search.
In linux. The storage location of all databases and user information can be viewed in (v
)
The default data file storage directory of MySQL is/var/lib/mysql. To move the directory to/home/data, perform the following steps:
1. create a data directory under the home directory
Cd/home
Mkdir data
2. stop the MySQL service process:
Mysqladmin-u root-p shutdown
3. move the entire/var/lib/mysql directory t
Then, configure MySQL.
[Root @ sample ~] # Vi/etc/my. cnf plugin edit the MySQL configuration file[Mysqld]Datadir =/var/lib/mysqlSocket =/var/lib/mysql. sock# Default to using old password format for compatibility with mysql 3.x# Clients (th
in the data directory # mkdir/data/mysqldb/logCreate a temporary mysql table directory # mkdir/opt/mysqltmp
3.Compile and install
# CmakeSet the mysql installation directory-DCMAKE_INSTALL_PREFIX =/usr/local/mysql/
Set the listening socket path, which must be an absolute path name. The default value is/tmp/mysql.
must specify the location where the mysql. sock file is generated. Change socket =/var/lib/mysql. sock to/home/mysql. sock. The procedure is as follows:Vi my. cnf (use the vi tool to edit the my. cnf file and find the following d
Configure multiple mysql versions in centos Environment
Scenario: You need to upgrade the original version of MySQL to a later version of mysql.
Solution: to reduce the impact of mysql upgrades on the business, you can configure a later version of mysql (multiple versions) o
/mysql/home/data/
In this way, the MySQL data file is moved to/home/data/mysql.
4. Find the my. cnf configuration file.
If my. for the cnf configuration file, go to/usr/share/mysql/and find *. copy one of the cnf files to/etc/and change it to my. cnf.
The command is as follows:
[Root @ test1
Apt-Get install libmysqlclient-Dev
MySQL uses XAMPP and needs to specify sock
Source code: Main. c
# If Defined (_ Win32) | defined (_ win64) // To support Compilation on Windows # Include # Endif # Include # Include # Include // On my machine, the file is in/usr/local/include/MySQL. // Define the macros for database operations, or write them direc
Shutdown
3. Move the entire/var/lib/MySQL directory to/home/Data
MV/var/lib/MySQL/home/data/
In this way, the MySQL data file is moved to/home/data/MySQL.
4. Find the my. CNF configuration file.
If my. for the CNF configuration file, go to/usr/share/MySQL/and find *. copy o
Recommended settings:
For a single running web server, we recommend that you add:
Skip-locking
Skip-name-resolve
Skip-networking
Use "localhost" when connecting to the database in PHP. In this way, the mysql client library will overwrite and try to connect to the local socket .(
We can use PHP. ini
Code:
; Default socket name for local MySQL connects. If empty, uses the built-in
;
) Add MySQL to the startup Service Group of your system.
[Root @ test1 local] #/sbin/chkconfig-add MySQL
3) Delete MySQL from the startup Service Group.
[Root @ test1 local] #/sbin/chkconfig-del MySQL
7. Change the MySQL directory
The default data file storage dire
your system.
[Root @ test1 local] #/sbin/chkconfig-add MySQL
3) Delete MySQL from the startup Service Group.
[Root @ test1 local] #/sbin/chkconfig-del MySQL
7. Change the MySQL directory
The default data file storage directory of MySQL is/var/lib/
/data/In this way, the MySQL data file is moved to/home/data/MySQL. 4. Find the my. CNF configuration file.If my. for the CNF configuration file, go to/usr/share/MySQL/and find *. copy one of the CNF files to/etc/and change it to my. CNF. The command is as follows:[Root @ test1 MySQL] # cp/usr/share/
debian is simple and has apt source.2) add MySQL to the startup service group of your system.[Root @ test1 local] #/sbin/chkconfig? Add mysql3) delete MySQL from the startup service group.[Root @ test1 local] #/sbin/chkconfig? Del mysql
7. change the MySQL Directory
The default data file storage directory of
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.