User Tools

Site Tools


mysql

MySQL Home

Configuration (mysql-5.5.27)

  • Under /etc/mysql, copy my-medium.cnf as my.cnf. (available template files are: my-huge.cnf, my-large.cnf, my-medium.cnf and my-small.cnf. my-medium.cnf is more than enough for small database such as “chemical”)
  • Edit my.cnf: replace “skip-locking” with “skip-external-locking” to avoid warning message like “'–skip-locking' is deprecated” ( ref). Update: for ver5.5.27, it is already “skip-external-locking” by default.
  • Install an initial database. (i.e., create the required user databases and put them in the right places)
sudo mysql_install_db --user=mysql
  • Add “yxue” to “mysql” group by editing /etc/group.
  • start mysql server. At this point, you should be able to run “mysql” from command line and get welcome information
sudo chmod +x /etc/rc.d/rc.mysqld
sudo /etc/rc.d/rc.mysqld start
  • setup a password for the Mysql root user
sudo su mysql
mysqladmin -u root password <new-password>
  • Note: the default database folder is “/var/lib/mysql/”

Mysql Commandline Quick Guide

Connect database

mysql -u root -p
mysql> use databackup;
mysql> help #get help information
mysql> show tables; #show tables in current database

Create tables

Run query

mysql> select * from datbak;

Insert a record

mysql>
mysql.txt · Last modified: 2024/03/14 05:35 by 127.0.0.1