MySQL 5.5 EC2のyumでインストール yum install mysql mysql-server mysql-devel
# mysql -V mysql Ver 14.14 Distrib 5.5.24, for Linux (x86_64) using readline 5.1 # mysql -u root -phogehoge Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 65 Server version: 5.5.24-log MySQL Community Server (GPL) Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
MySQL 5.6.7 rc MySQLのdownloadsからrpmを取得しインストール Linux - Generic 2.6 (x86, 64-bit), RPM Package MySQL-server-5.6.7_rc-1.linux2.6.x86_64.rpm MySQL-client-5.6.7_rc-1.linux2.6.x86_64.rpm MySQL-devel-5.6.7_rc-1.linux2.6.x86_64.rpm MySQL-shared-5.6.7_rc-1.linux2.6.x86_64.rpm
# mysql -V mysql Ver 14.14 Distrib 5.6.7-rc, for Linux (x86_64) using EditLine wrapper # mysql -u root -phogehoge Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 63 Server version: 5.6.7-rc-log MySQL Community Server (GPL) Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
# /usr/bin/mysql_secure_instal ation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just instal ed MySQL, and you haven't set the root password yet, the password wil be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successful y used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] Y New password: Re-enter new password: Password updated successful y! Reloading privilege tables.. ... Success! By default, a MySQL instal ation has an anonymous user, al owing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the instal ation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normal y, root should only be al owed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disal ow root login remotely? [Y/n] n ... skipping. By default, MySQL comes with a database named 'test' that 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? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables wil ensure that al changes made so far wil take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... Al done! If you've completed al of the above steps, your MySQL instal ation should now be secure. Thanks for using MySQL!
sequenceテーブル Sequenc CREATE TABLE `sequence` ( e `id` bigint(20) unsigned NOT ①ID発行 NULL ) ENGINE=MyISAM; UPDATE sequence SET id=LAST_INSERT_ID(id+1); App User shard1 ②発行されたIDを使ってINSERT User shard2 SELECT LAST_INSERT_ID(); User shard3