how to setup localhost in mysql code example Example 1: connect to mysql localhost from the mysql shell \connect root@localhost:3306 Example 2: mysql root localhost run mysql -u root mysql