Thursday, April 5, 2012

mysql 5.5.22 in Ubuntu 11.10 server

Because apt-get mysql only have 5.1.x , I want to use 5.5.x , so need this memo...


==Install==

sudo groupadd mysql

sudo useradd -r -g mysql mysql

cd /usr/local

sudo  tar zxvf mysql-5.5.22-linux2.6-i686.tar.gz

sudo ln -s mysql-5.5.22-linux2.6-i686 mysql

rm mysql-5.5.22-linux2.6-i686.tar.gz ( if you won't keep)

cd mysql

sudo chown -R mysql .

sudo chgrp -R mysql .


(sure /etc/my.cnf、mysql has been delete)

(sudo apt-get install libaio1 if no have)

scripts/mysql_install_db --user=mysql

if success , will see msg like:

Installing MySQL system tables...
OK
Filling help tables...
OK


To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:


./bin/mysqladmin -u root password 'root'
./bin/mysqladmin -u root -h VWmare password 'new-password'


Alternatively you can run:
./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.


See the manual for more instructions.


You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &


You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl


Please report any problems with the ./bin/mysqlbug script!




==Setting==

sudo chown -R root .

sudo chown -R mysql data

sudo cp support-files/my-medium.cnf /etc/my.cnf

sudo cp support-files/mysql.server /etc/init.d/mysql.server


(start  mysql)
sudo bin/mysqld_safe --user=mysql &

(check is work listening 3306)
netstat -nat


(setting password)

./bin/mysqladmin -u root password 'new-password'

or

./bin/mysql_secure_installation



(use)

cd bin

./mysql -u root -p 'xxx'


(start in boot)

cd /etc/init.d/
sudo update-rc.d mysql.server defaults



(set character )

sudo vim /etc/mysql/my.cnf

[client]

default-character-set=utf8



[mysqld]

character-set-server=utf8
collation-server=utf8_general_ci


(use mysql check character)

mysql> show variables like 'character%';

will see:

| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |




==Remote==

sure my.cnf : skip-networking is marked 

ex: #skip-networking


mysql>grant all privileges on *.* to USER@IP identified by "PASSWORD";

mysql>FLUSH PRIVILEGES;

(more info : search mysql grant or mysql remote in google :P)



PS: Get error msg in   /usr/local/mysql/data/ubuntu.err

No comments: