The following articles mainly introduce the simple configuration of the MySQL database under Ubuntu, including the correct installation layout of MySQL under ubuntu and the modification of the storage directory of MySQL database files, the following describes the specific content of the article.
1). MySQL installation layout in ubuntu:
/Usr/bin client program and MySQL_install_db
/Db database and log files (custom)
/Var/run MySQLd Server
/Etc/MySQL configuration file my. cnf
/Usr/share/MySQL Character Set, baseline program and error message
/Etc/init. d/MySQL start MySQL Server
2) modify the storage directory of MySQL database files:
Assume that the specified database file directory is/db.
1. Create a directory/db and change its owner and group to MySQL: MySQL. Command: chown MySQL: MySQL db
2. Disable MySQL Database Service: MySQLadmin-u root-p shutdown
3. Modify MySQL configuration file my. cnf: Change datadir =/var/lib/MySQL to datadir =/db
4. reinitialize the data file: Execute MySQL_install_db
5. start MySQL Database Service: sudo/etc/init. d/MySQL start
6. Set the MySQL Database root password: MySQLadmin-u root password 'new-password'
At this time, we will find MySQL-related files in the/db directory. If we create a new database, its database files will also appear in the db directory. Indicates that the file storage directory of the MySQL database we modified is correct.
The above content is an introduction to the simple configuration of MySQL database in Ubuntu. I hope you will get some benefits.