Здесь показаны различия между двумя версиями данной страницы.
| Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
| freebsd:mysql [2019/11/10 18:58] alex | freebsd:mysql [2020/02/01 17:46] (текущий) alex | ||
|---|---|---|---|
| Строка 40: | Строка 40: | ||
| https://www.mysql.com/ | https://www.mysql.com/ | ||
| + | Запускаю mysql-server | ||
| service mysql-server onestart | service mysql-server onestart | ||
| Starting mysql. | Starting mysql. | ||
| + | Проверяю статус mysql-server | ||
| service mysql-server onestatus | service mysql-server onestatus | ||
| mysql is running as pid 53015. | mysql is running as pid 53015. | ||
| Строка 59: | Строка 60: | ||
|  |  | ||
| Connecting to MySQL server using password in '/root/.mysql_secret' | Connecting to MySQL server using password in '/root/.mysql_secret' | ||
| - |  | ||
| - | VALIDATE PASSWORD PLUGIN can be used to test passwords | ||
| - | and improve security. It checks the strength of password | ||
| - | and allows the users to set only those passwords which are | ||
| - | secure enough. Would you like to setup VALIDATE PASSWORD plugin? | ||
|  |  | ||
| VALIDATE PASSWORD PLUGIN можно использовать для проверки паролей | VALIDATE PASSWORD PLUGIN можно использовать для проверки паролей | ||
| Строка 80: | Строка 76: | ||
|  |  | ||
| Estimated strength of the password: 100 | Estimated strength of the password: 100 | ||
| - | Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y | + | Вы хотите продолжить с предоставленным паролем? (Нажмите y | Y для Да, любую другую клавишу для Нет): y | 
| - | By default, a MySQL installation has an anonymous user, | + | По умолчанию установка MySQL имеет анонимного пользователя, | 
| - | allowing anyone to log into MySQL without having to have | + | позволяя кому-либо войти в MySQL без  | 
| - | a user account created for them. This is intended only for | + | учетной запись пользователя, созданной для них. Это предназначено только для | 
| - | testing, and to make the installation go a bit smoother. | + | тестирование, и сделано для гладкой установки. | 
| - | You should remove them before moving into a production | + | Вы должны удалить их, прежде чем начать использовать. | 
| - | environment. | + | |
|  |  | ||
| Remove anonymous users? (Press y|Y for Yes, any other key for No) : y | Remove anonymous users? (Press y|Y for Yes, any other key for No) : y | ||
| Success. | Success. | ||
|  |  | ||
| - | Normally, root should only be allowed to connect from | + | Обычно пользователю root разрешено подключаться только с | 
| - | 'localhost'. This ensures that someone cannot guess at | + | «Локально». Это гарантирует, что кто-то не может подобрать | 
| - | the root password from the network. | + | пароль root из сети. | 
|  |  | ||
| Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y | Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y | ||
| Success. | Success. | ||
|  |  | ||
| - | By default, MySQL comes with a database named 'test' that | + | По умолчанию MySQL поставляется с базой данных «test», к которой | 
| - | anyone can access. This is also intended only for testing, | + | любой может получить доступ. Это также предназначено только для тестирования, | 
| - | and should be removed before moving into a production | + | и должна быть удалена перед началом использования. | 
| - | environment. | + | |
| - |  | + | |
|  |  | ||
| Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y | Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y | ||
| Строка 111: | Строка 104: | ||
| Success. | Success. | ||
|  |  | ||
| - | Reloading the privilege tables will ensure that all changes | + | Перезагрузка таблиц привилегий гарантирует, что все изменения | 
| - | made so far will take effect immediately. | + | сделанные до сих пор вступит в силу немедленно. | 
|  |  | ||
| Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y | Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y | ||
| Строка 119: | Строка 112: | ||
| All done! | All done! | ||
| - | Проверяю подключение у MySQL | + | Проверяю подключение к MySQL | 
| mysql -uroot -p | mysql -uroot -p | ||
| Enter password: | Enter password: | ||
| Строка 133: | Строка 126: | ||
|  |  | ||
| Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. | Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. | ||
| - | + | show databases; | |
| - | root@localhost [(none)]> show databases; | + | ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. | 
| + | |||
| + | Получаю ошибку. MySQL почему то думает, что у пользователя root нет пароля. Делаю | ||
| + | SET PASSWORD = PASSWORD('//мой пароль//'); | ||
| + | show databases; | ||
| +--------------------+ | +--------------------+ | ||
| | Database  | | | Database  | | ||
| Строка 145: | Строка 142: | ||
| 4 rows in set (0.00 sec) | 4 rows in set (0.00 sec) | ||
|  |  | ||
| - | root@localhost [(none)]> quit | + | quit | 
| Bye | Bye | ||
| Для запуска MySQL при старте в /etc/rc.conf добавляю строку | Для запуска MySQL при старте в /etc/rc.conf добавляю строку | ||
| - | mysql_enable="YES" | + | sysrc mysql_enable="YES" | 
| ===== Настройка UTF8 кодировки по-умолчанию ===== | ===== Настройка UTF8 кодировки по-умолчанию ===== | ||
| Строка 157: | Строка 154: | ||
|  |  | ||
| [mysqld] | [mysqld] | ||
| - | character-set-server = utf8 | + | #character-set-server = utf8 **УСТАРЕЛО** | 
| - | collation-server = utf8_unicode_ci | + | #collation-server = utf8_unicode_ci **УСТАРЕЛО** | 
| + | character-set-server  =utf8mb4 | ||
| + | collation-server  =utf8mb4_unicode_ci | ||
| Перезапускаю MySQL | Перезапускаю MySQL | ||