Mysql установка

Материал из rrv-wiki
Перейти к навигации Перейти к поиску


Запустим скрипт безопасности

mysql_secure_installation


FreeBSD 8.0

#cd /usr/ports && make search name=^mysql-server | less

Находим нужную нам версию.

# cd /usr/ports/databases/mysql55-server
# make WITH_CHARSET=utf8 WITH_COLLATION=utf8_general_ci install clean

В папке /usr/local/share/mysql находятся примеры конфигурационных файлов:

my-huge.cnf
my-innodb-heavy-4G.cnf
my-large.cnf
my-medium.cnf
my-small.cnf

выбираем на свой вкус и копируем в /etc

# cp /usr/local/share/mysql/my-large.cnf /etc/my.cnf

Запускаем:

# mysql_install_db

Выдает ошибку:

............
100423 12:52:13 [ERROR] /usr/local/libexec/mysqld: unknown variable 'thread_concurrency=8'
100423 12:52:13 [ERROR] Aborting
............

Странно, не знает thread_concurrency=8 ладно, за комментируем строку thread_concurrency=8 в файле /etc/my.cnf

Запускаем снова:

# mysql_install_db
Installing MySQL system tables...
100423 14:02:55 [Note] Buffered information: Performance schema disabled (reason: start parameters).

OK
Filling help tables...
100423 14:02:55 [Note] Buffered information: Performance schema disabled (reason: start parameters).

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:

/usr/local/bin/mysqladmin -u root password 'new-password'
/usr/local/bin/mysqladmin -u root -h hostname password 'new-password'

Alternatively you can run:
/usr/local/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 /usr/local ; /usr/local/bin/mysqld_safe &

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

Please report any problems with the /usr/local/bin/mysqlbug script!

Все прошло успешно. Не забудем создать пароль root-а mysql как сказано выше:

$ /usr/local/bin/mysqladmin -u root password
New password:
Confirm new password:

Запускаем сервер:

# /usr/local/etc/rc.d/mysql-server start

Не стартонул... Смотрим лог /var/db/mysql/hostname.err:

100423 13:05:45 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/local/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
100423 13:05:45 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
100423 13:05:45  InnoDB: highest supported file format is Barracuda.
100423 13:05:46 InnoDB 1.1.0 started; log sequence number 1595687
100423 13:05:46 [Note] Recovering after a crash using mysql-bin
100423 13:05:46 [Note] Starting crash recovery...
100423 13:05:46 [Note] Crash recovery finished.
100423 13:05:46 [ERROR] /usr/local/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
100423 13:05:46 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
100423 13:05:46 mysqld_safe mysqld from pid file /var/db/mysql/hostname.pid ended

Видимо проблемы с правами, исправим:

# mysql -R mysql /var/db/mysql

Запускаем сервер:

# /usr/local/etc/rc.d/mysql-server start

Стартонул:

# /usr/local/etc/rc.d/mysql-server status
mysql is running as pid 2399.