1). MySQL installation layout in Ubuntu:/usr/bin client program and mysql_install_db/db & nbs
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.