pages tagged mysql http://meng6net.localhost/tag/mysql/ <p><small>Copyright © 2005-2020 by <code>Meng Lu &lt;lumeng3@gmail.com&gt;</code></small></p> Meng Lu's home page ikiwiki Tue, 16 May 2017 23:59:39 +0000 Installing and configuring MySQL http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_mysql/ http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_mysql/ computing configuration documentation installation mysql note software Tue, 16 May 2017 23:59:39 +0000 2017-05-16T23:59:39Z <pre> <code>sudo apt-get install mysql-server php5-mysql mysql-client phpmyadmin mysql-workbench mysql-utilities </code></pre> <h2>Create MySQL database directory structure</h2> <p>Create its database directory structure where it will store its information.</p> <pre><code>$ sudo mysql_install_db Installing MySQL system tables... 150604 22:38:27 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 150604 22:38:27 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.14.04.1) starting as process 10093 ... OK Filling help tables... 150604 22:38:28 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 150604 22:38:28 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.14.04.1) starting as process 10099 ... 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/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h mengmaclaplx password 'new-password' Alternatively you can run: /usr/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 ; /usr/bin/mysqld_safe &amp; You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ </code></pre> <h2>Security-improving modification and configuration</h2> <pre><code>$ mysql_secure_installation 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 installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing 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 installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y ... Success! 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] n ... skipping. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! </code></pre> <h3>Install MySQL 5.6 instead of the default 5.5 on Ubuntu Linux 14.04</h3> <pre> <code>sudo apt-get install mysql-server-5.6 mysql-client-5.6 mysql-client-core-5.6 Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libctemplate2 libmysqlcppconn7 libodbc1 libpcrecpp0 libvsqlitepp3 libzip2 mysql-workbench-data python-pyodbc python-pysqlite2 Use 'apt-get autoremove' to remove them. The following extra packages will be installed: mysql-common-5.6 mysql-server-core-5.6 Suggested packages: mailx tinyca The following packages will be REMOVED: mysql-client mysql-client-5.5 mysql-client-core-5.5 mysql-server mysql-server-5.5 mysql-server-core-5.5 mysql-workbench The following NEW packages will be installed: mysql-client-5.6 mysql-client-core-5.6 mysql-common-5.6 mysql-server-5.6 mysql-server-core-5.6 0 upgraded, 5 newly installed, 7 to remove and 0 not upgraded. Need to get 19.8 MB of archives. After this operation, 4,525 kB disk space will be freed. </code></pre> <h3>Install MySQL Workbench</h3> <p>Download newest version from http://dev.mysql.com/downloads/workbench/ and install it.</p> <h2>References</h2> <ul> <li><a href= "https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04"> How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04</a></li> </ul> <h2>Security-related configuration</h2>