Simple configuration MySQL database under Ubuntu

Source: Internet
Author: User
Tags character set log modify mysql mysql database
Simple configuration MySQL database under Ubuntu

i). Ubuntu under MySQL installation layout:

/usr/bin Client Programs and mysql_install_db
/db database and log files
/var/run mysqld Server
/etc/mysql mysql configuration file my.cnf
/usr/share/mysql character set, benchmark program, and error message
/etc/init.d/mysql start MySQL server

II. Set up the MySQL server to automatically start and close with the switch machine:

System-> System Management-> Service
After you go to the Service Settings window, you can activate the MySQL database service

III. Modify the storage directory for MySQL database files:

Suppose we specify the database file directory as/db
1. Create the directory/db and modify the owner and the group to which they belong mysql:mysql. Command: chown mysql:mysql db
2. Close MySQL database service: mysqladmin-u root-p shutdown
3. Modify MySQL profile my.cnf: Change Datadir=/var/lib/mysql to datadir=/db
4. Reinitialize 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 point 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 we modified the MySQL database file storage directory correctly.

IV). Configure the MySQL database InnoDB storage Engine:

1. To view the MySQL storage engine condition: Log in to the MySQL database and engage show engines at the mysql> prompt. Discovery: InnoDB YES, stating that this MySQL database server supports the InnoDB engine.
2. Set INNODB as the default engine: In the configuration file my.cnf, under [mysqld], add a default-storage-engine=innodb sentence and save it.
3. Restart MySQL server: mysqladmin-u root-p shutdown (enter), Sudo/etc/init.d/mysql start (enter).
4. Login to the MySQL database, at the mysql> prompt to get into show engines command. If InnoDB default is present, we set InnoDB as the default engine success.
PS: Here I use the restart command sudo/etc/init.d/mysql restart, there is an error message, so use the above (step 3) that shut down the service and start the stupid method.



Related Article

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: info-contact@alibabacloud.com 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.