测试之路交流

mysql 配置

上一篇 / 下一篇  2011-03-15 09:13:22 / 个人分类:mysql

#change root user's password for mysql
mysqladmin -u root -h localhost password 'new_password'

# Alternatively you can run:
/usr/bin/mysql_secure_installation

# which will also give you the option of removing the test databases and anonymous user created by default.  This is strongly recommended for production servers.

# login with root user
mysql -u root -h localhost

# import a *.sql into one database
mysql -uroot -p dbname <src.sql

# show databases
show databases;

# create user sa via any host by using password '123456'
create user 'sa'@'%' identified by '123456';

# grant all privileges for user sa on JESS database
grant all privileges on JESS.* to 'sa'@'%' with grant option;

# show grants for user
show grants for 'sa'@'%';

# delete user, the user's related previliges will be revoked
drop user 'sa'@'%';

# show variables
show variables like "%character%";
# custom parameter setting, set timeout to 1 year (in seconds)
# in /etc/my.cnf, under [mysqld]
wait_timeout = 31536000
interactive_timeout = 31536000

# create database
create database db;

# delete database
drop database db;

# specified key was too long problem, character set -> utf8
test@linux-uv0s:~/Download/JESS-Setup/SQLFiles> mysql -uroot -p testagms <back_mysql_test2.sql
Enter password:
ERROR 1071 (42000) at line 4: Specified key was too long; max key length is 1000 bytes

# show create table command
show create table AttendanceRecord;

# show engines
show engines;

# change default engine
# config file format, /etc/my.cnf
default-storage-engine=InnoDB
# command line format
--default-storage-engine=InnoDB


TAG:

 

评分:0

我来说两句

Open Toolbar