测试之路交流

发布新日志

  • mysql 配置

    2011-03-15 09:13:22

    #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

  • mysql配置

    2011-03-04 15:28:55

    #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


  • ubuntu 彻底删除 mysql 然后重装 mysql

    2010-12-08 16:50:29

    删除 mysql
    sudo apt-get autoremove --purge mysql-server-5.0
    sudo apt-get remove mysql-server
    sudo apt-get autoremove mysql-server
    sudo apt-get remove mysql-common //这个很重要
    上面的其实有一些是多余的。

    清理残留数据

    dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P




    安装 mysql

    sudo apt-get install mysql-server
    sudo apt-get install mysql-client
    sudo apt-get install php5-mysql
    // 安装php5-mysql 是将php和mysql连接起来
    一旦安装完成,MySQL 服务器应该自动启动。您可以在终端提示符后运行以下命令来检查 MySQL 服务器是否正在运行:
    sudo netstat -tap | grep mysql

    当您运行该命令时,您可以看到类似下面的行:
    tcp 0 0 localhost.localdomain:mysql *:* LISTEN -

    如果服务器不能正常运行,您可以通过下列命令启动它:
    sudo /etc/init.d/mysql restart

    进入mysql

    $mysql -uroot -p 管理员密码


    配置 MySQL 的管理员密码:
    sudo mysqladmin -u root password newpassword

Open Toolbar