First steps
After installing mysql, an initial database must be created, and some parameters should be passed to mysqld.
Create a /etc/my.cnf
[client]
port=3306
[mysqld]
port=3306
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
old_passwords=1
# enable after creating initial database
# log_slow_queries=/var/mysql/mysql-slow.log
# tunning
max_connections=50
key_buffer=64M
table_cache=100
wait_timeout=180
max_allowed_packet=4M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 2
# innodb
default-storage-engine=innodb
innodb_flush_log_at_trx_commit=1
innodb_buffer_pool_size=16M
innodb_log_file_size=10M
innodb_log_buffer_size=5M
innodb_data_home_dir=/var/mysql/ibdata/
innodb_file_per_table
innodb_data_file_path=ibdata1:10M:autoextend #this is for undo and other system data
[mysqldump]
quick
quote-names
max_allowed_packet=16M
Creating mysql initial database
cd /usr/local/mysql
scripts/mysql_install_db --user=mysql
Starting mysql
I have this in my /service/mysql/run. Alternatively, you can use the same options on mysqld_safe. Note, --default-files must be the first parameter supplied.
exec /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --user=mysql --datadir=/var/mysql/data --log-warnings
Creating database and tables
CREATE DATABASE mydb;
USE mydb;
CREATE TABLE mytable(name varchar(20)) engine=InnoDB;
ALTER TABLE TABLE_NAME engine=InnoDB;
User admin
To add user:
GRANT ALL PRIVILEGES ON ~.~ TO myUser@localhost
IDENTIFIED BY 'pass' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON ~.~ TO myUser@"%"
IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
To remove user:
DELETE FROM user WHERE user='username';
FLUSH PRIVILEGES;
Installing from source
This was used to compile mysql-5.1.29rc. --enable-innodb is not documented in configure --help but without it, mysql will be built without innodb! Ref:
http://venublog.com/2008/04/21/mysql-5124-innodb-plugin-10-failures-server-crash/∞
./configure \
--prefix=/usr/local/mysql \
--sysconfdir=/etc \
--enable-local-infile \
--with-charset=utf8 \
--with-unix-socket-path=/usr/local/mysql/run/mysql.sock \
--with-mysqld-user=mysql \
--with-ssl=/usr/local/ssl \
--with-plugins=csv,heap,innobase,myisam,myisammrg,partition,ftexample,archive,federated \
--enable-innodb \
--with-server-suffix=-custom
Running into problems? Check
http://dev.mysql.com/doc/refman/5.1/en/compilation-problems.html∞
There are no comments on this page. [Add comment]