mariadb - install

DB/MariaDB 2014. 7. 20. 16:12


Install MariaDB 10 on Fedora 23/22, CentOS/RHEL 7.1/6.7/5.11


MariaDB is a binary drop in replacement for MySQL database server. This means that for most cases, you can just uninstall MySQL and install MariaDB and you are good to go.

Why MariaDB?

  • MariaDB is totally open source version of MySQL
  • It works just like MySQL and is compatible with MySQL setups
  • Fedora and Red Hat/CentOS is moving to use MariaDB from Fedora 19/RHEL 7/CentOS 7 versions

This is guide, howto install or upgrade MariaDB 10.0.22 (or 10.1.8 or 5.5.46) on Fedora 23/22/21/20, CentOS 7.1/6.7/5.11 and Red Hat (RHEL) 7.1/6.7/5.11. Installing MariaDB is almost same process than install MySQL.

Note: If you are moving from MySQL, then make sure that you backup (dump and copy) your database and configs. And if upgrading from earlier versions, then remember run mysql_upgrade command. And if you uninstall MySQL, then remember restore /etc/my.cnf after installation, like:

Install MariaDB/MariaDB-server 10.1.8/10.0.28/5.5.46 on Fedora 23/22/21/20, CentOS 7.1/6.7/5.11, Red Hat (RHEL) 7.1/6.7/5.11

1. Change root user

2. Install MariaDB repository

Following commands are just shortcut to install original MariaDB YUM repos, alternatively you could use MariaDB repository configuration tool.

Fedora 21/20

Note: currently only option for Fedora 23/22 users is MariaDB 10.0 and not additional repos needed.

CentOS 7/6/5

Red Hat (RHEL) 7/6/5

3. Update or Install MariaDB 10.0/10.1/5.5

Fedora 23/22

Fedora 21/20, CentOS 7.1/6.7/5.11 and Red Hat (RHEL) 7.1/6.7/5.11

4. Start MariaDB server and autostart MariaDB on boot

Fedora 23/22

Fedora 21/20, CentOS 7.1/6.7/5.11 and Red Hat (RHEL) 7.1/6.7/5.11

5. MariaDB (MySQL) Secure Installation

  • Set (Change) root password
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test database and access to it
  • Reload privilege tables

Start MariaDB (MySQL) Secure Installation with following command

Output:

Note: If you don’t want some reason, do a “MySQL Secure Installation” then at least it’s very important to change the root user’s password

6. Connect to MySQL database (localhost) with password

7. Create Database, Create MySQL User and Enable Remote Connections to MySQL Database

This example uses following parameters:

  • DB_NAME = webdb
  • USER_NAME = webdb_user
  • REMOTE_IP = 10.0.15.25
  • PASSWORD = password123
  • PERMISSIONS = ALL

Enable Remote Connection to MariaDB Server –> Open MySQL Port (3306) on Iptables Firewall (as root user again)

1. CentOS/Red Hat (RHEL) 6.7/5.11

1.1 Edit /etc/sysconfig/iptables file:

1.2 Add following INPUT rule:

1.3 Restart Iptables Firewall:

2. Fedora 23/22/21/20 and CentOS/Red Hat (RHEL) 7.1

2.1 List Your Active Firewalld Zones

Example output:

2.2 Add New Rule to Firewalld

You might have active zone like public, FedoraWorkstation, FedoraServer.

2.3 Restart firewalld.service

3. Test remote connection




source - http://www.if-not-true-then-false.com/2013/install-mariadb-on-fedora-centos-rhel/








Install MariaDB 5.5.37 on Fedora 20/19, CentOS/Red Hat (RHEL) 6.5/5.10


MariaDB is a binary drop in replacement for MySQL database server. This means that for most cases, you can just uninstall MySQL and install MariaDB and you are good to go.

Why MariaDB?

  • MariaDB is totally open source version of MySQL
  • It works just like MySQL and is compatible with MySQL setups
  • Fedora and Red Hat/CentOS is moving to use MariaDB from Fedora 19/RHEL 7/CentOS 7 versions

This is guide, howto install or upgrade MariaDB 5.5.37 on Fedora 20/19/18/17, CentOS 6.5/5.10 and Red Hat (RHEL) 6.5/5.10. Installing MariaDB is almost same process than install MySQL.

Note: If you are moving from MySQL, then make sure that you backup (dump and copy) your database and configs. And if upgrading from earlier versions, then remember run mysql_upgrade command. And if you uninstall MySQL, then remember restore /etc/my.cnf after installation, like:

mv -vi /etc/my.cnf.rpmsave /etc/my.cnf

Install MariaDB/MariaDB-server 5.5.37 on Fedora 20/19/18/17, CentOS 6.5/5.10, Red Hat (RHEL) 6.5/5.10

1. Change root user

su -
## OR ##
sudo -i

2. Install MariaDB repository

Fedora

Note: not needed/available on Fedora 20! Fedora 20 MariaDB version, is currently 5.5.33a.

## Fedora 19/18/17 MariaDB 5.5 ##
wget -O /etc/yum.repos.d/MariaDB.repo http://mariadb.if-not-true-then-false.com/fedora/$(rpm -E %fedora)/$(uname -i)/5
 
## Fedora 19/18/17 MariaDB 10.0 ##
wget -O /etc/yum.repos.d/MariaDB.repo http://mariadb.if-not-true-then-false.com/fedora/$(rpm -E %fedora)/$(uname -i)/10

CentOS

## CentOS 6/5 MariaDB 5.5 ##
wget -O /etc/yum.repos.d/MariaDB.repo http://mariadb.if-not-true-then-false.com/centos/$(rpm -E %centos)/$(uname -i)/5
 
## CentOS 6/5 MariaDB 10.0 ##
wget -O /etc/yum.repos.d/MariaDB.repo http://mariadb.if-not-true-then-false.com/centos/$(rpm -E %centos)/$(uname -i)/10

Red Hat (RHEL)

## Red Hat (RHEL) 6/5 MariaDB 5.5 ##
wget -O /etc/yum.repos.d/MariaDB.repo http://mariadb.if-not-true-then-false.com/rhel/$(rpm -E %rhel)/$(uname -i)/5
 
## Red Hat (RHEL) 6/5 MariaDB 10.0 ##
wget -O /etc/yum.repos.d/MariaDB.repo http://mariadb.if-not-true-then-false.com/rhel/$(rpm -E %rhel)/$(uname -i)/10

Remember check your

3. Update or Install MariaDB 5.5.37

Fedora 20

yum install mariadb mariadb-server

Fedora 19/18/17, CentOS 6.5/5.10 and Red Hat (RHEL) 6.5/5.10

yum install MariaDB MariaDB-server

4. Start MariaDB server and autostart MariaDB on boot

Fedora 20

systemctl start mariadb.service ## use restart after update
 
systemctl enable mariadb.service

Fedora 19/18/17, CentOS 6.5/5.10 and Red Hat (RHEL) 6.5/5.10

service mysql start ## use restart after update
## OR ##
/etc/init.d/mysql start ## use restart after update
 
chkconfig --levels 235 mysql on

5. MariaDB (MySQL) Secure Installation

  • Set (Change) root password
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test database and access to it
  • Reload privilege tables

Start MariaDB (MySQL) Secure Installation with following command

/usr/bin/mysql_secure_installation

Output:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
 
In order to log into MariaDB to secure it, we\'ll need the current
password for the root user.  If you\'ve just installed MariaDB, 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 MariaDB
root user without the proper authorisation.
 
Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!
 
 
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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, MariaDB 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 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 MariaDB
installation should now be secure.
 
Thanks for using MariaDB!

Note: If you don’t want some reason, do a “MySQL Secure Installation” then at least it’s very important to change the root user’s password

mysqladmin -u root password [your_password_here]
 
## Example ##
mysqladmin -u root password myownsecrectpass

6. Connect to MySQL database (localhost) with password

mysql -u root -p
 
## OR ##
mysql -h localhost -u root -p

7. Create Database, Create MySQL User and Enable Remote Connections to MySQL Database

This example uses following parameters:

  • DB_NAME = webdb
  • USER_NAME = webdb_user
  • REMOTE_IP = 10.0.15.25
  • PASSWORD = password123
  • PERMISSIONS = ALL
## CREATE DATABASE ##
MariaDB [(NONE)]> CREATE DATABASE webdb;
 
## CREATE USER ##
MariaDB [(NONE)]> CREATE USER 'webdb_user'@'10.0.15.25' IDENTIFIED BY 'password123';
 
## GRANT PERMISSIONS ##
MariaDB [(NONE)]> GRANT ALL ON webdb.* TO 'webdb_user'@'10.0.15.25';
 
##  FLUSH PRIVILEGES, Tell the server TO reload the GRANT TABLES  ##
MariaDB [(NONE)]> FLUSH PRIVILEGES;

Enable Remote Connection to MariaDB Server –> Open MySQL Port (3306) on Iptables Firewall (as root user again)

1. CentOS/Red Hat (RHEL)

1.1 Edit /etc/sysconfig/iptables file:

nano -w /etc/sysconfig/iptables

1.2 Add following INPUT rule:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

1.3 Restart Iptables Firewall:

service iptables restart
## OR ##
/etc/init.d/iptables restart

2. Fedora

2.1 Add New Rule to Firewalld

firewall-cmd --permanent --zone=public --add-service=mysql
 
## OR ##
 
firewall-cmd --permanent --zone=public --add --port=3306/tcp

2.2 Restart firewalld.service

systemctl restart firewalld.service

3. Test remote connection

Access following address, with your browser. http://your.domain/test.php












source - http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/








# vi /etc/my.cnf

#

# This group is read both both by the client and the server

# use it for options that affect everything

#

[client-server]


#

# This group is read by the server

#

[mysqld]

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0


init_connect=SET character_set_server=utf8

init_connect=SET collation_connection=utf8_general_ci

init_connect=SET NAMES utf8

character-set-server=utf8

collation-server=utf8_general_ci


#

# include all files from the config directory

#

!includedir /etc/my.cnf.d


[client]

default-character-set=utf8


[mysql]

default-character-set=utf8


[mysqldump]

default-character-set=utf8




'DB > MariaDB' 카테고리의 다른 글

mariadb - Activating the General Query Log  (0) 2015.06.10
Posted by linuxism
,


JavaScript Naming Conventions

This document defines JavaScript naming conventions, which are split into essential, coding and naming conventions.

Contents

  1. Essential Conventions
    1. Minimizing Globals
    2. Use jslint
  2. Coding Conventions
    1. Uses two-space indentation
    2. Using shorthand for conditional statements
    3. Opening Brace Location
    4. Closing Brace Location
    5. Function Declaration Location
    6. Object Declaration
  3. Naming Conventions
    1. Constructors
    2. Methods/Functions
    3. TitleCase, camelCase
    4. Variables
    5. Element Classes and IDs
    6. Underscore Private Methods
    7. No Abbreviations
    8. No Plurals
    9. Use Comments
    10. Documentation
  4. Additional Readings


Essential Conventions

Essential conventions include generic patterns that should be adhered in order to write readableconsistent andmaintainable code.

Minimizing Globals

Variable declarations should always be made using var to not declare them as global variables. This avoids conflicts from using a variable name across different functions as well as conflicts with global variables declared by 3rd party plugins.

Good Example

function sum(x, y) {
  var result = x + y;
  return result;
}

Bad Example

function sum(x, y) {
  // missing var declaration, implied global
  result = x + y;
  return result;
}

Use JSLint

JSLint (http://jslint.com/) is a quality tools that inspects code and warns about potential problems. It is available online and can also be integrated into several development environments, so errors will be highlighted when writing code.

Before validating your code in JSLint, you should use a code beautifier to fix basic syntax errors (like indentation) automatically. There are a number of beautifiers available online. The following seem to be the best working:

Here, javascript sources have to begin with this header: /*jslint indent: 2, maxlen: 80, nomen: true */, which means it uses two spaces indentation, 80 maximum characters by line and allow the use of '_' as first variable name character. Other JSLint options can be added in sub functions if necessary; Allowed options are:

  • ass: true if assignment should be allowed outside of statement position.
  • bitwise: true if bitwise operators should be allowed.
  • continue: true if the continue statement should be allowed.
  • newcap: true if Initial Caps with constructor function is optional.
  • regexp: true if . and [^...] should be allowed in RegExp literals. They match more material than might be expected, allowing attackers to confuse applications. These forms should not be used when validating in secure applications.
  • unparam: true if warnings should not be given for unused parameters.

Coding Conventions

Coding conventions include generic patterns that ensure that written code adheres to certain formatting conventions.

Uses two-space indentation

Tabs and 2-space indentation are being used equally. Since a lot of errors on JSLint often result from mixed use of space and tab using 2 spaces throughout prevents these errors up front.

Good Example

function outer(a, b) {
  var c = 1,
    d = 2,
    inner;
  if (a > b) {
    inner = function () {
      return {
        "r": c - d
      };
    };
  } else {
    inner = function () {
      return {
        "r": c + d
      };
    };
  }
  return inner;
}  

Bad Example

function outer(a, b) {
var c = 1,
d = 2,
inner;

if (a > b) {
inner = function () {
return {
"r": c - d
}}}};

Using shorthand for conditional statements

An alternative for using braces is the shorthand notation for conditional statements. When using multiple conditions, the conditional statement can be split on multiple lines.

Good Example

// single line
var results = test === true ? alert(1) : alert(2);

// multiple lines
var results = (test === true && number === undefined ?
               alert(1) : alert(2));

var results = (test === true ?
               alert(1) : number === undefined ?
               alert(2) : alert(3));

Bad Example

// multiple conditions
var results = (test === true && number === undefined) ?
  alert(1) :
  alert(2);

Opening Brace Location

Always put the opening brace on the same line as the previous statement.

Bad Example

function func()
{
  return
  {
    "name": "Batman"
  };
}  

Good Example

function func () {
  return {
    "name": "Batman"
  };
}

Closing Brace Location

The closing brace should be on the same indent as the original function call.

Bad Example

function func() {
  return {
           "name": "Batman"
         };
}

Good Example

function func() {
  return {
    "name": "Batman"
  };
}

Function Declaration Location

Non anonymous functions should be declared before use.

Bad Example

// [...]
return {
  "namedFunction": function namedFunction() {
    return;
  }
};

Good Example

// [...]
function namedFunction() {
  return;
}
return {
  "namedFunction": namedFunction
};

Object Declaration

On some interpreters, declaring an object with object keys not wrapped in quotes can throw syntax errors. Here we use double quotes.

Bad example

var my_object = {
  key: "value"
};

Good example

var my_object = {
  "key": "value"
};

Naming Conventions

Naming conventions include generic patterns for setting names and identifiers throughout a script.

Constructors

A constructor function starting with new should always start with a capital letter

// bad example
var test = new application();

// good example
var test = new Application();

Methods/Functions

A method/function should always start with a small letter.

// bad example
function MyFunction() {...}

// good example
function myFunction() {...}

TitleCase, camelCase

Follow the camel case convention, typing the words in lower-case, only capitalizing the first letter in each word.

Examples

// Good example constructor = TitleCase
var test = new PrototypeApplication();

// Bad example constructor
var test = new PROTOTYPEAPPLICATION();

// Good example functions/methods = camelCase
myFunction();
calculateArea();

// Bad example functions/methods
MyFunction();
CalculateArea();  

Variables

Variables with multiple words should always use an underscore between words.

Example

// bad example
var deliveryNote = 1;

// good example
var delivery_note = 1;

Confusing variable names should end with the variable type.

Example

// implicit type
var my_callback = doSomething();
var Person = require("./person");

// confusing names + var type
var do_something_function = doSomething.bind(context);
var value_list = getObjectOrArray();
// value_list can be an object which can be cast into an array

To use camelCase, when sometimes it is impossible to declare a function directly, the function variable name should match some patterns which shows that it is a function.

// good example
var doSomethingFunction = function () { ... };
// or
var tool = {"doSomething": function () { ... }};

// bad example
var doSomething = function () { ... };

Element Classes and IDs

JavaScript can access elements by their ID attribute and class names. When assigning IDs and class names with multiple words, these should also be separated by an underscore (same as variables).

Example

// bad example
test.setAttribute("id", "uniqueIdentifier");

// good example
test.setAttribute("id", "unique_identifier");  

Discuss - checked with jQuery UI/jQuery Mobile, they don't use written name conventions, only

  • events names should fit their purpose (pageChange for changing a page)
  • element classes use “-” like in ui-shadow
  • "ui" should not be used by third party developers
  • variables and events use lower camel-case like pageChange and activePage

Underscore Private Methods

Private methods should use a leading underscore to separate them from public methods (although this does not technically make a method private).

Good Example

var person = {
  "getName": function () {
    return this._getFirst() + " " + this._getLast();
  },
  "_getFirst": function () {
    // ...
  },
  "_getLast": function () {
    // ...
  }
};  

Bad Example

var person = {
  "getName": function () {
    return this.getFirst() + " " + this.getLast();
  },
  // private function
  "getFirst": function () {
    // ...
  }
};

No Abbreviations

Abbreviations should not be used to avoid confusion

Good Example

// delivery note
var delivery_note = 1;

Bad Example

// delivery note
var del_note = 1;

No Plurals

Plurals should not be used when assigning names

Good Example

var delivery_note_list = ["one", "two"];

Bad Example

var delivery_notes = ["one", "two"];

Use Comments

Should be used with reason but include enough information so that a reader can get a first grasp of what a part of code is supposed to do.

Good Example

var person = {
  // returns full name string
  "getName": function () {
    return this._getFirst() + " " + this._getLast();
  }
};

Bad Example

var person = {
  "getName": function () {
    return this._getFirst() + " " + this._getLast();
  }
};

Documentation

You can use YUIDoc (http://yuilibrary.com/projects/ yuidoc) and their custom comment tags together with Node.js to generate the documentation from the script file itself. Comments will look something like this:

Good Example

/**
 * Reverse a string
 *
 * @param  {String} input_string String to reverse
 * @return {String} The reversed string
 */
function reverse(input_string) {
  // ...
  return output_string;
};

Bad Example

function reverse(input_string) {
  // ...
  return output_string;
};  

Additional Readings

Resources, additional reading materials and links used


Status:

  • 2012-11-16 first version
  • 2013-01-10 updated to JSLint, removed rules enforced by JSLint



source - http://www.j-io.org/Javascript-Naming_Conventions





Posted by linuxism
,


In fedora 17 when an application is running, you can pin it to the favourites bar (left side by default), this menu item is no longer available after I did the upgraded to fedora 18, the running applications appears in the favourite bar but I can't add them, The option to remove them is available however.



1-first, you must create a "desktop" file in this path: /usr/share/applications

for example : touch /usr/share/applications/eclipse.desktop

2-open the file with an editor like vim

vim /usr/share/applications/eclipse.desktop

then write this parameters in the file:(for example I want to add Eclipse launcher)

[Desktop Entry]
Type=Application
Name=Eclipse
Comment= "write your comment"
Icon=the icon path ,something like /opt/eclipse/icon.xpm
Exec=the execution command ,something like /opt/eclipse/eclipse
Terminal=false
Categories=write categories like : Development;IDE;Java;

then save the changes.

3-now you must add execution permission to the file using this command :

chmod +x /usr/share/applications/eclipse.desktop

then ,this application is been added to Application bar and you can add it to favorites bar.



source - https://ask.fedoraproject.org/en/question/24832/how-to-add-an-application-to-the-favorites-bar-in-gnome-in-fedora-18/










'System > Linux' 카테고리의 다른 글

linux - 부트로더(lilo, grub)  (0) 2014.07.26
fedora - nautilus preference  (0) 2014.07.22
linux - disable ipv6  (0) 2014.07.04
linux - PID(Process ID) save at start  (0) 2014.05.29
linux - ipvsadm(lvs) manpage  (0) 2014.05.10
Posted by linuxism
,